timshannon / badgerhold

BadgerHold is an embeddable NoSQL store for querying Go types built on Badger
MIT License
514 stars 52 forks source link

Specifying indexes without tags #88

Closed mycroftcanner closed 1 year ago

mycroftcanner commented 1 year ago

Is there a way to specify indexes without using tags? We would like to be able to use protobuf generated structs.

timshannon commented 1 year ago

You can implement the Storer interface, to specify your own indexes, rather than using the badgerHoldIndex struct tag.

Take a look at the source code to see how I do it there, and if you want the same behavior without using tags, you can just copy those methods to your type.