timshannon / badgerhold

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

StartsWith operator #3

Closed nkev closed 5 years ago

nkev commented 5 years ago

This is fantastic Tim, let me be the first to congratulate you! I'd love to make some contributions too if you'll consider them. The first thing that comes to mind are StartsWith and EndsWith operators for string fields. I think they would be useful for multi-segmented keys and indexes:

store.Find(badgerhold.Where(badgerhold.Key).StartsWith("en-AU:")

I know we can probably already do this using Regex or MatchFunc but it looks more readable with the above syntax.

timshannon commented 5 years ago

Simpler, Clearer, and probably faster than Regex. Sounds worth it to me.

nkev commented 5 years ago

I'll try to get a pull request to you soon.

nkev commented 5 years ago

I just started a major new project and won't have time to implement this any time soon, unfortunately.