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

Unified Diff: go/src/infra/gae/libs/wrapper/memory/datastore.go

Issue 1160253002: Add initial Query generation, correctness checking and index generation. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: address comments and stuff Created 5 years, 7 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
Index: go/src/infra/gae/libs/wrapper/memory/datastore.go
diff --git a/go/src/infra/gae/libs/wrapper/memory/datastore.go b/go/src/infra/gae/libs/wrapper/memory/datastore.go
index 9573d7b46cd78f24eab1ef12300043ea9ef1effa..df76d6ad96975ba51a2d28d8319a3d936600d7c0 100644
--- a/go/src/infra/gae/libs/wrapper/memory/datastore.go
+++ b/go/src/infra/gae/libs/wrapper/memory/datastore.go
@@ -116,6 +116,32 @@ var (
_ = wrapper.Testable((*txnDsImpl)(nil))
)
+func (d *dsImpl) NewQuery(kind string) wrapper.DSQuery {
+ return &queryImpl{DSQuery: wrapper.DummyQY(), ns: d.ns, kind: kind}
+}
+
+func (d *dsImpl) Run(q wrapper.DSQuery) wrapper.DSIterator {
+ rq := q.(*queryImpl)
+ rq = rq.normalize().checkCorrectness(d.ns, false)
+ return &queryIterImpl{rq}
+}
+
+func (d *dsImpl) GetAll(q wrapper.DSQuery, dst interface{}) ([]*datastore.Key, error) {
+ // TODO(riannucci): assert that dst is a slice of structs
+ return nil, nil
+}
+
+func (d *dsImpl) Count(q wrapper.DSQuery) (ret int, err error) {
+ itr := d.Run(q.KeysOnly())
+ for _, err = itr.Next(nil); err != nil; _, err = itr.Next(nil) {
+ ret++
+ }
+ if err == datastore.Done {
+ err = nil
+ }
+ return
+}
+
func (d *txnDsImpl) BreakFeatures(err error, features ...string) {
d.data.BreakFeatures(err, features...)
}
« no previous file with comments | « go/src/infra/gae/libs/wrapper/memory/binutils.go ('k') | go/src/infra/gae/libs/wrapper/memory/datastore_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698