Skip to content

Commit

Permalink
Store: Set start/end prefix even when one argument is given.
Browse files Browse the repository at this point in the history
  • Loading branch information
cschomburg committed May 21, 2017
1 parent ac5ab6c commit 9f20005
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions services/store/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,13 @@ type DocsPayload struct {
}

func (s *Service) doScan(collection string, p scanMessage) (interface{}, error) {
if p.Start == "" && p.End == "" {
if p.Prefix != "" {
p.Start = p.Prefix
p.End = p.Prefix + "~~~~~" // oh god, what a hack
if p.Prefix != "" {
start, end := clampPrefix(p.Prefix)
if p.Start == "" {
p.Start = start
}
if p.End == "" {
p.End = end
}
}
if p.Limit == 0 {
Expand Down Expand Up @@ -312,3 +315,7 @@ func (s *Service) doScan(collection string, p scanMessage) (interface{}, error)
return DocsPayload{keys, values}, nil
}
}

func clampPrefix(prefix string) (start, end string) {
return prefix, prefix + " ~~~~~"
}

0 comments on commit 9f20005

Please sign in to comment.