Skip to content

Commit 2badd36

Browse files
committed
MapDatastore: obey KeysOnly
We use this datastore in tests all the time so it should match the behavior of _actual_ datastores as much as possible.
1 parent b19d692 commit 2badd36

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

basic_ds.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ func (d *MapDatastore) Delete(key Key) (err error) {
6464
func (d *MapDatastore) Query(q dsq.Query) (dsq.Results, error) {
6565
re := make([]dsq.Entry, 0, len(d.values))
6666
for k, v := range d.values {
67-
re = append(re, dsq.Entry{Key: k.String(), Value: v})
67+
e := dsq.Entry{Key: k.String()}
68+
if !q.KeysOnly {
69+
e.Value = v
70+
}
71+
re = append(re, e)
6872
}
6973
r := dsq.ResultsWithEntries(q, re)
7074
r = dsq.NaiveQueryApply(q, r)

0 commit comments

Comments
 (0)