Index: impl/memory/datastore.go |
diff --git a/impl/memory/datastore.go b/impl/memory/datastore.go |
index 62c9a99825b8b045c832d76958bc1c816d827563..e9d7a66d98008b01657dd5637a1a1d04cae0c5d2 100644 |
--- a/impl/memory/datastore.go |
+++ b/impl/memory/datastore.go |
@@ -68,6 +68,11 @@ func (d *dsImpl) Run(fq *ds.FinalizedQuery, cb ds.RawRunCB) error { |
return executeQuery(fq, d.ns, false, idx, head, cb) |
} |
+func (d *dsImpl) Count(fq *ds.FinalizedQuery) (ret int64, err error) { |
+ idx, head := d.data.getQuerySnaps(!fq.EventuallyConsistent()) |
+ return countQuery(fq, d.ns, false, idx, head) |
+} |
+ |
func (d *dsImpl) AddIndexes(idxs ...*ds.IndexDefinition) { |
if len(idxs) == 0 { |
return |
@@ -145,6 +150,10 @@ func (d *txnDsImpl) Run(q *ds.FinalizedQuery, cb ds.RawRunCB) error { |
return executeQuery(q, d.ns, true, d.data.snap, d.data.snap, cb) |
} |
+func (d *txnDsImpl) Count(fq *ds.FinalizedQuery) (ret int64, err error) { |
+ return countQuery(fq, d.ns, true, d.data.snap, d.data.snap) |
+} |
+ |
func (*txnDsImpl) RunInTransaction(func(c context.Context) error, *ds.TransactionOptions) error { |
return errors.New("datastore: nested transactions are not supported") |
} |