Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

added param string_rev for reverse order of keys with same size #141

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

recoilme
Copy link

@recoilme recoilme commented Feb 7, 2017

Hi, Dima!
This little PR add reverse order for string keys
For example you have keys:

r:99:105
r:100:123
r:101:100
r:102:9
r:1000:1

And you need to iterate keys in reverse order:

//db settings
sp_setstring(env, "db.db.scheme", "key", 0);
sp_setstring(env, "db.db.scheme.key", "string_rev,key(0)", 0);
//cursor settings
sp_setstring(o, "order", ">=", 0)
sp_setstring(o, "prefix", "r:10", strlen("r:10"));
//return
r:102:9
r:101:100
r:100:123
r:1000:1

it's useful for key:timestamp for example, then key is string
I use it here: https://github.com/recoilme/okdb

@pmwkaa
Copy link
Owner

pmwkaa commented Feb 7, 2017

Hi, looks useful :) thanks.

To complete this feature, a few more things should be accomplished:

  1. support for min/max position should be implemented in the same way as for other numeric types:
    https://github.com/pmwkaa/sophia/blob/master/sophia/format/sf_limit.h#L154. This works, when we open lte/gte cursor, but without key set.

  2. tests for string_rev https://github.com/pmwkaa/sophia/blob/master/test/generic/rev.test.c

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants