peterbourgon / diskv

A disk-backed key-value store.

Home Page:http://godoc.org/github.com/peterbourgon/diskv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

does diskv support range query?

ifq opened this issue · comments

commented

I'm look for a embedded db, and I feel diskv might be a choise. But I need to do some range query.

my scene is: I have some files, about 50000, each file have properties like size, time, tags which stored in db. I need to range query them by time or tags.

Does diskv support this? or in key-value db, how should I achieve this ?

thank you.

diskv is primarily a content-addressable-store, with very basic support for key ordering via the Index functionality.

If you want to do a range query over some property, you can construct your keys so that they contain this information, and write a custom LessFunction which sorts them by the property you care about.

Of course, this only allows one sort-order per diskv instance. If you need arbitrary ordering, it's probably a good sign that need a more sophisticated persistence layer than diskv.

Does that help?

commented

thank you. That helps.
may be I need to reconsider my approach.