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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // func(obj TYPE, getCursor CursorCB) bool | 76 // func(obj TYPE, getCursor CursorCB) bool |
77 // | 77 // |
78 // Where TYPE is one of: | 78 // Where TYPE is one of: |
79 // - S or *S where S is a struct | 79 // - S or *S where S is a struct |
80 // - P or *P where *P is a concrete type implementing PropertyLoadSave
r | 80 // - P or *P where *P is a concrete type implementing PropertyLoadSave
r |
81 // - Key (implies a keys-only query) | 81 // - Key (implies a keys-only query) |
82 // | 82 // |
83 // Run stops on the first error encountered. | 83 // Run stops on the first error encountered. |
84 Run(q Query, cb interface{}) error | 84 Run(q Query, cb interface{}) error |
85 | 85 |
| 86 // DecodeCursor converts a string returned by a Cursor into a Cursor ins
tance. |
| 87 // It will return an error if the supplied string is not valid, or could
not |
| 88 // be decoded by the implementation. |
| 89 DecodeCursor(string) (Cursor, error) |
| 90 |
86 // GetAll retrieves all of the Query results into dst. | 91 // GetAll retrieves all of the Query results into dst. |
87 // | 92 // |
88 // dst must be one of: | 93 // dst must be one of: |
89 // - *[]S or *[]*S where S is a struct | 94 // - *[]S or *[]*S where S is a struct |
90 » // - *[]P or *[]*P where *P is a concrete type implementing PropertyLo
adSaver | 95 » // - *[]P or *[]*P where *P is a concrete type implementing |
| 96 » // PropertyLoadSaver |
91 // - *[]Key implies a keys-only query. | 97 // - *[]Key implies a keys-only query. |
92 GetAll(q Query, dst interface{}) error | 98 GetAll(q Query, dst interface{}) error |
93 | 99 |
94 // Get retrieves a single object from the datastore | 100 // Get retrieves a single object from the datastore |
95 // | 101 // |
96 // dst must be one of: | 102 // dst must be one of: |
97 // - *S where S is a struct | 103 // - *S where S is a struct |
98 // - *P where *P is a concrete type implementing PropertyLoadSaver | 104 // - *P where *P is a concrete type implementing PropertyLoadSaver |
99 Get(dst interface{}) error | 105 Get(dst interface{}) error |
100 | 106 |
(...skipping 10 matching lines...) Expand all Loading... |
111 | 117 |
112 // Delete removes an item from the datastore. | 118 // Delete removes an item from the datastore. |
113 Delete(key Key) error | 119 Delete(key Key) error |
114 | 120 |
115 // GetMulti retrieves items from the datastore. | 121 // GetMulti retrieves items from the datastore. |
116 // | 122 // |
117 // dst must be one of: | 123 // dst must be one of: |
118 // - []S or []*S where S is a struct | 124 // - []S or []*S where S is a struct |
119 // - []P or []*P where *P is a concrete type implementing PropertyLoad
Saver | 125 // - []P or []*P where *P is a concrete type implementing PropertyLoad
Saver |
120 // - []I where I is some interface type. Each element of the slice mus
t | 126 // - []I where I is some interface type. Each element of the slice mus
t |
121 » //» » be non-nil, and its underlying type must be either *S o
r *P. | 127 » // be non-nil, and its underlying type must be either *S or *P. |
122 GetMulti(dst interface{}) error | 128 GetMulti(dst interface{}) error |
123 | 129 |
124 // PutMulti writes items to the datastore. | 130 // PutMulti writes items to the datastore. |
125 // | 131 // |
126 // src must be one of: | 132 // src must be one of: |
127 // - []S or []*S where S is a struct | 133 // - []S or []*S where S is a struct |
128 // - []P or []*P where *P is a concrete type implementing PropertyLoad
Saver | 134 // - []P or []*P where *P is a concrete type implementing PropertyLoad
Saver |
129 // - []I where i is some interface type. Each elemet of the slice must | 135 // - []I where i is some interface type. Each elemet of the slice must |
130 // be non-nil, and its underlying type must be either *S or *P. | 136 // be non-nil, and its underlying type must be either *S or *P. |
131 // | 137 // |
132 // If items in src resolve to Incomplete keys, PutMulti will write the | 138 // If items in src resolve to Incomplete keys, PutMulti will write the |
133 // resolved keys back to the items in src. | 139 // resolved keys back to the items in src. |
134 PutMulti(src interface{}) error | 140 PutMulti(src interface{}) error |
135 | 141 |
136 // DeleteMulti removes items from the datastore. | 142 // DeleteMulti removes items from the datastore. |
137 DeleteMulti(keys []Key) error | 143 DeleteMulti(keys []Key) error |
138 | 144 |
139 // Raw returns the underlying RawInterface. The Interface and RawInterfa
ce may | 145 // Raw returns the underlying RawInterface. The Interface and RawInterfa
ce may |
140 // be used interchangably; there's no danger of interleaving access to t
he | 146 // be used interchangably; there's no danger of interleaving access to t
he |
141 // datastore via the two. | 147 // datastore via the two. |
142 Raw() RawInterface | 148 Raw() RawInterface |
143 } | 149 } |
OLD | NEW |