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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/datastore/datastore_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/interface.go
diff --git a/service/datastore/interface.go b/service/datastore/interface.go
index d4afa69a6b9a487d413476878665c3759fea2a07..6c954b9006025c284ef2156a58e8fa20d6cf18a4 100644
--- a/service/datastore/interface.go
+++ b/service/datastore/interface.go
@@ -118,6 +118,18 @@ type Interface interface {
// - *[]*Key implies a keys-only query.
GetAll(q *Query, dst interface{}) error
+ // Does a Get for this key and returns true iff it exists. Will only return
+ // an error if it's not ErrNoSuchEntity. This is slightly more efficient
+ // than using Get directly, because it uses the underlying RawInterface to
+ // avoid some reflection and copies.
+ Exists(k *Key) (bool, error)
+
+ // Does a GetMulti for thes keys and returns true iff they exist. Will only
+ // return an error if it's not ErrNoSuchEntity. This is slightly more efficient
+ // than using Get directly, because it uses the underlying RawInterface to
+ // avoid some reflection and copies.
+ ExistsMulti(k []*Key) ([]bool, error)
+
// Get retrieves a single object from the datastore
//
// dst must be one of:
« 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