-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added Query.SeekPrefix #119
base: master
Are you sure you want to change the base?
Conversation
There should probably be a naive implementation in query_impl.go |
Something like: type FilterKeySeekPrefix struct {
SeekPrefix string
}
func (f FilterKeySeekPrefix) Filter(e Entry) bool {
return e.Key >= f.SeekPrefix
} and func NaiveQueryApply(q Query, qr Results) Results {
if q.Prefix != "" {
qr = NaiveFilter(qr, FilterKeyPrefix{q.Prefix})
}
if q.SeekPrefix != "" {
qr = NaiveFilter(qr, FilterKeySeekPrefix{q.SeekPrefix})
}
... ? |
That will just act like |
Let's say we have entries whose keys are zero-padded time codes for speedy scanning by time: .SeekPrefix could be something like type FilterKeySeekPrefix struct {
Ascending bool
SeekPrefix string
}
func (f FilterKeySeekPrefix) Filter(e Entry) bool {
if f.Ascending {
return e.Key >= f.SeekPrefix
} else {
return e.Key <= f.SeekPrefix
}
} Is the only place |
You're right, assuming ordering by key, that should work. Actually, I'm starting to wonder how this should interact with sorting by value. Let's discuss here: #116 (comment)
We use it in the |
Ok cool, thanks for indulging me on that ques and glad you're catching this stuff. Like that we're gettin through this together and adding a nice feature to ds. |
This looks pretty stale... does that mean another avenue was chosen? Or key seeking is still not possible? |
No description provided.