Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: service/datastore/interface.go

Issue 1398103003: Add Exists and ExistsMulti convenience methods (Closed) Base URL: https://github.com/luci/gae.git@add_version_id
Patch Set: comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « service/datastore/datastore_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // GetAll retrieves all of the Query results into dst. 112 // GetAll retrieves all of the Query results into dst.
113 // 113 //
114 // dst must be one of: 114 // dst must be one of:
115 // - *[]S or *[]*S where S is a struct 115 // - *[]S or *[]*S where S is a struct
116 // - *[]P or *[]*P where *P is a concrete type implementing 116 // - *[]P or *[]*P where *P is a concrete type implementing
117 // PropertyLoadSaver 117 // PropertyLoadSaver
118 // - *[]*Key implies a keys-only query. 118 // - *[]*Key implies a keys-only query.
119 GetAll(q *Query, dst interface{}) error 119 GetAll(q *Query, dst interface{}) error
120 120
121 // Does a Get for this key and returns true iff it exists. Will only ret urn
122 // an error if it's not ErrNoSuchEntity. This is slightly more efficient
123 // than using Get directly, because it uses the underlying RawInterface to
124 // avoid some reflection and copies.
125 Exists(k *Key) (bool, error)
126
127 // Does a GetMulti for thes keys and returns true iff they exist. Will o nly
128 // return an error if it's not ErrNoSuchEntity. This is slightly more ef ficient
129 // than using Get directly, because it uses the underlying RawInterface to
130 // avoid some reflection and copies.
131 ExistsMulti(k []*Key) ([]bool, error)
132
121 // Get retrieves a single object from the datastore 133 // Get retrieves a single object from the datastore
122 // 134 //
123 // dst must be one of: 135 // dst must be one of:
124 // - *S where S is a struct 136 // - *S where S is a struct
125 // - *P where *P is a concrete type implementing PropertyLoadSaver 137 // - *P where *P is a concrete type implementing PropertyLoadSaver
126 Get(dst interface{}) error 138 Get(dst interface{}) error
127 139
128 // Put inserts a single object into the datastore 140 // Put inserts a single object into the datastore
129 // 141 //
130 // src must be one of: 142 // src must be one of:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 177
166 // Testable returns the Testable interface for the implementation, or ni l if 178 // Testable returns the Testable interface for the implementation, or ni l if
167 // there is none. 179 // there is none.
168 Testable() Testable 180 Testable() Testable
169 181
170 // Raw returns the underlying RawInterface. The Interface and RawInterfa ce may 182 // Raw returns the underlying RawInterface. The Interface and RawInterfa ce may
171 // be used interchangably; there's no danger of interleaving access to t he 183 // be used interchangably; there's no danger of interleaving access to t he
172 // datastore via the two. 184 // datastore via the two.
173 Raw() RawInterface 185 Raw() RawInterface
174 } 186 }
OLDNEW
« no previous file with comments | « service/datastore/datastore_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698