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 "golang.org/x/net/context" | 8 "golang.org/x/net/context" |
9 ) | 9 ) |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // NewKeyToks constructs a new key in the current appID/Namespace, using
the | 56 // NewKeyToks constructs a new key in the current appID/Namespace, using
the |
57 // specified key tokens. | 57 // specified key tokens. |
58 NewKeyToks([]KeyTok) *Key | 58 NewKeyToks([]KeyTok) *Key |
59 | 59 |
60 // KeyForObjErr extracts a key from src. | 60 // KeyForObjErr extracts a key from src. |
61 // | 61 // |
62 // src must be one of: | 62 // src must be one of: |
63 // - *S where S is a struct | 63 // - *S where S is a struct |
64 // - a PropertyLoadSaver | 64 // - a PropertyLoadSaver |
65 // | 65 // |
66 » // It is expected that the struct or PropertyLoadSaver exposes the | 66 » // It is expected that the struct exposes the following metadata (as ret
rieved |
67 » // following metadata (as retrieved by PropertyLoadSaver.GetMeta): | 67 » // by MetaGetter.GetMeta): |
68 // - "key" (type: Key) - The full datastore key to use. Must not be ni
l. | 68 // - "key" (type: Key) - The full datastore key to use. Must not be ni
l. |
69 // OR | 69 // OR |
70 // - "id" (type: int64 or string) - The id of the Key to create | 70 // - "id" (type: int64 or string) - The id of the Key to create |
71 // - "kind" (optional, type: string) - The kind of the Key to create.
If | 71 // - "kind" (optional, type: string) - The kind of the Key to create.
If |
72 // blank or not present, KeyForObjErr will extract the name of the s
rc | 72 // blank or not present, KeyForObjErr will extract the name of the s
rc |
73 // object's type. | 73 // object's type. |
74 // - "parent" (optional, type: Key) - The parent key to use. | 74 // - "parent" (optional, type: Key) - The parent key to use. |
75 // | 75 // |
| 76 // By default, the metadata will be extracted from the struct and its ta
gged |
| 77 // properties. However, if the struct implements MetaGetterSetter it is |
| 78 // wholly responsible for exporting the required fields. A struct that |
| 79 // implements GetMeta to make some minor tweaks can evoke the defualt be
havior |
| 80 // by using GetPLS(s).GetMeta. |
| 81 // |
76 // If a required metadata item is missing or of the wrong type, then thi
s will | 82 // If a required metadata item is missing or of the wrong type, then thi
s will |
77 // return an error. | 83 // return an error. |
78 KeyForObjErr(src interface{}) (*Key, error) | 84 KeyForObjErr(src interface{}) (*Key, error) |
79 | 85 |
80 // RunInTransaction runs f inside of a transaction. See the appengine SD
K's | 86 // RunInTransaction runs f inside of a transaction. See the appengine SD
K's |
81 // documentation for full details on the behavior of transactions in the | 87 // documentation for full details on the behavior of transactions in the |
82 // datastore. | 88 // datastore. |
83 // | 89 // |
84 // Note that the behavior of transactions may change depending on what f
ilters | 90 // Note that the behavior of transactions may change depending on what f
ilters |
85 // have been installed. It's possible that we'll end up implementing thi
ngs | 91 // have been installed. It's possible that we'll end up implementing thi
ngs |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 183 |
178 // Testable returns the Testable interface for the implementation, or ni
l if | 184 // Testable returns the Testable interface for the implementation, or ni
l if |
179 // there is none. | 185 // there is none. |
180 Testable() Testable | 186 Testable() Testable |
181 | 187 |
182 // Raw returns the underlying RawInterface. The Interface and RawInterfa
ce may | 188 // Raw returns the underlying RawInterface. The Interface and RawInterfa
ce may |
183 // be used interchangably; there's no danger of interleaving access to t
he | 189 // be used interchangably; there's no danger of interleaving access to t
he |
184 // datastore via the two. | 190 // datastore via the two. |
185 Raw() RawInterface | 191 Raw() RawInterface |
186 } | 192 } |
OLD | NEW |