| 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 datastore | 5 package datastore |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 | 9 |
| 10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // stop. If you return the error `Stop`, then Run will stop the query and | 30 // stop. If you return the error `Stop`, then Run will stop the query and |
| 31 // return nil. | 31 // return nil. |
| 32 type RawRunCB func(key *Key, val PropertyMap, getCursor CursorCB) error | 32 type RawRunCB func(key *Key, val PropertyMap, getCursor CursorCB) error |
| 33 | 33 |
| 34 // GetMultiCB is the callback signature provided to RawInterface.GetMulti | 34 // GetMultiCB is the callback signature provided to RawInterface.GetMulti |
| 35 // | 35 // |
| 36 // - val is the data of the entity | 36 // - val is the data of the entity |
| 37 // * It may be nil if some of the keys to the GetMulti were bad, since all | 37 // * It may be nil if some of the keys to the GetMulti were bad, since all |
| 38 // keys are validated before the RPC occurs! | 38 // keys are validated before the RPC occurs! |
| 39 // - err is an error associated with this entity (e.g. ErrNoSuchEntity). | 39 // - err is an error associated with this entity (e.g. ErrNoSuchEntity). |
| 40 // |
| 41 // Return nil to continue iterating, or an error to stop. If you return the |
| 42 // error `Stop`, then GetMulti will stop the query and return nil. |
| 40 type GetMultiCB func(val PropertyMap, err error) error | 43 type GetMultiCB func(val PropertyMap, err error) error |
| 41 | 44 |
| 42 // PutMultiCB is the callback signature provided to RawInterface.PutMulti | 45 // PutMultiCB is the callback signature provided to RawInterface.PutMulti |
| 43 // | 46 // |
| 44 // - key is the new key for the entity (if the original was incomplete) | 47 // - key is the new key for the entity (if the original was incomplete) |
| 45 // * It may be nil if some of the keys/vals to the PutMulti were bad, since | 48 // * It may be nil if some of the keys/vals to the PutMulti were bad, since |
| 46 // all keys are validated before the RPC occurs! | 49 // all keys are validated before the RPC occurs! |
| 47 // - err is an error associated with putting this entity. | 50 // - err is an error associated with putting this entity. |
| 51 // |
| 52 // Return nil to continue iterating, or an error to stop. If you return the |
| 53 // error `Stop`, then PutMulti will stop the query and return nil. |
| 48 type PutMultiCB func(key *Key, err error) error | 54 type PutMultiCB func(key *Key, err error) error |
| 49 | 55 |
| 50 // DeleteMultiCB is the callback signature provided to RawInterface.DeleteMulti | 56 // DeleteMultiCB is the callback signature provided to RawInterface.DeleteMulti |
| 51 // | 57 // |
| 52 // - err is an error associated with deleting this entity. | 58 // - err is an error associated with deleting this entity. |
| 59 // |
| 60 // Return nil to continue iterating, or an error to stop. If you return the |
| 61 // error `Stop`, then DeleteMulti will stop the query and return nil. |
| 53 type DeleteMultiCB func(err error) error | 62 type DeleteMultiCB func(err error) error |
| 54 | 63 |
| 55 type nullMetaGetterType struct{} | 64 type nullMetaGetterType struct{} |
| 56 | 65 |
| 57 func (nullMetaGetterType) GetMeta(string) (interface{}, bool) { return nil, fals
e } | 66 func (nullMetaGetterType) GetMeta(string) (interface{}, bool) { return nil, fals
e } |
| 58 | 67 |
| 59 var nullMetaGetter MetaGetter = nullMetaGetterType{} | 68 var nullMetaGetter MetaGetter = nullMetaGetterType{} |
| 60 | 69 |
| 61 // MultiMetaGetter is a carrier for metadata, used with RawInterface.GetMulti | 70 // MultiMetaGetter is a carrier for metadata, used with RawInterface.GetMulti |
| 62 // | 71 // |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // - len(keys) > 0 | 171 // - len(keys) > 0 |
| 163 // - all keys are Valid, !Incomplete, and in the current namespace | 172 // - all keys are Valid, !Incomplete, and in the current namespace |
| 164 // - none keys of the keys are 'special' (use a kind prefixed with '__
') | 173 // - none keys of the keys are 'special' (use a kind prefixed with '__
') |
| 165 // - cb is not nil | 174 // - cb is not nil |
| 166 DeleteMulti(keys []*Key, cb DeleteMultiCB) error | 175 DeleteMulti(keys []*Key, cb DeleteMultiCB) error |
| 167 | 176 |
| 168 // Testable returns the Testable interface for the implementation, or ni
l if | 177 // Testable returns the Testable interface for the implementation, or ni
l if |
| 169 // there is none. | 178 // there is none. |
| 170 Testable() Testable | 179 Testable() Testable |
| 171 } | 180 } |
| OLD | NEW |