OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package prod | 5 package prod |
6 | 6 |
7 import ( | 7 import ( |
8 ds "github.com/luci/gae/service/datastore" | 8 ds "github.com/luci/gae/service/datastore" |
9 "github.com/luci/gae/service/info" | 9 "github.com/luci/gae/service/info" |
10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 cb(vals[idx].(*typeFilter).pm, err) | 110 cb(vals[idx].(*typeFilter).pm, err) |
111 }) | 111 }) |
112 } | 112 } |
113 | 113 |
114 func (d rdsImpl) PutMulti(keys []ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB
) error { | 114 func (d rdsImpl) PutMulti(keys []ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB
) error { |
115 rkeys := dsMF2R(keys) | 115 rkeys := dsMF2R(keys) |
116 rvals := make([]datastore.PropertyLoadSaver, len(vals)) | 116 rvals := make([]datastore.PropertyLoadSaver, len(vals)) |
117 for i, val := range vals { | 117 for i, val := range vals { |
118 rvals[i] = &typeFilter{val} | 118 rvals[i] = &typeFilter{val} |
119 } | 119 } |
120 » rkeys, err := datastore.PutMulti(d, rkeys, vals) | 120 » rkeys, err := datastore.PutMulti(d, rkeys, rvals) |
121 return idxCallbacker(err, len(keys), func(idx int, err error) { | 121 return idxCallbacker(err, len(keys), func(idx int, err error) { |
122 k := ds.Key(nil) | 122 k := ds.Key(nil) |
123 if err == nil { | 123 if err == nil { |
124 k = dsR2F(rkeys[idx]) | 124 k = dsR2F(rkeys[idx]) |
125 } | 125 } |
126 cb(k, err) | 126 cb(k, err) |
127 }) | 127 }) |
128 } | 128 } |
129 | 129 |
130 func (d rdsImpl) NewQuery(kind string) ds.Query { | 130 func (d rdsImpl) NewQuery(kind string) ds.Query { |
(...skipping 17 matching lines...) Expand all Loading... |
148 if !cb(dsR2F(k), tf.pm, cfunc) { | 148 if !cb(dsR2F(k), tf.pm, cfunc) { |
149 return nil | 149 return nil |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
sactionOptions) error { | 154 func (d rdsImpl) RunInTransaction(f func(c context.Context) error, opts *ds.Tran
sactionOptions) error { |
155 ropts := (*datastore.TransactionOptions)(opts) | 155 ropts := (*datastore.TransactionOptions)(opts) |
156 return datastore.RunInTransaction(d, f, ropts) | 156 return datastore.RunInTransaction(d, f, ropts) |
157 } | 157 } |
OLD | NEW |