From 2badd3670aa91ae396a8c03281bb3a1f8ee195ee Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 18 Apr 2019 16:32:18 -0700 Subject: [PATCH] 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. --- basic_ds.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/basic_ds.go b/basic_ds.go index ccfe14d..19b74e2 100644 --- a/basic_ds.go +++ b/basic_ds.go @@ -64,7 +64,11 @@ func (d *MapDatastore) Delete(key Key) (err error) { func (d *MapDatastore) Query(q dsq.Query) (dsq.Results, error) { re := make([]dsq.Entry, 0, len(d.values)) for k, v := range d.values { - re = append(re, dsq.Entry{Key: k.String(), Value: v}) + e := dsq.Entry{Key: k.String()} + if !q.KeysOnly { + e.Value = v + } + re = append(re, e) } r := dsq.ResultsWithEntries(q, re) r = dsq.NaiveQueryApply(q, r)