-
Notifications
You must be signed in to change notification settings - Fork 287
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
How to set the key's index and iterator? #25
Comments
Indexes can only be assigned to values. You cannot add an index to a key. The key is always ordered by it's binary value. You will need to format your timestamp so it's sortable. For example:
Or if you want to make the best use of space you can store the nanoseconds representation an The following serializes a key := make([]byte, 8)
binary.LittleEndian.PutUint64(key, timestamp.UnixNano()) Then add the key/value to the database. tx.Set(string(key), "some value", nil) |
@tidwall i want use Multi Value Index with json,like this |
db.CreateIndex("index_name", "*", buntdb.IndexJSON("product"), buntdb.IndexJSON("level")) please see https://github.com/tidwall/buntdb#multi-value-index |
@tidwall i see set Multi Value Index,but how can ascend equal this two conditions? |
See #18 for an example of how to ascend specialized JSON queries. |
@tidwall I'm very sorry ,I have a lot of questions,Thank you for your answer patiently。
i want to query use
output:
Not descending by |
My key was timestamps ,and i want use the timestamps key iterator,Hao to do it?
however the Index can only be set the key of values ?
The text was updated successfully, but these errors were encountered: