I've used BoltDB <https://github.com/boltdb/bolt> in a quite a few projects, and have found it to be fast and very reliable. But I've found that I was writing the same serialization and filtering code for each project, so I thought I'd try and build a more generic, reusable solution for storing and retrieving Go Types in a BoltDB file.
https://github.com/timshannon/bolthold You simply open a BoltHold file and start inserting Go types: store, err := bolthold.Open(filename, 0666, nil)if err != nil { //handle error } err = store.Insert("key", &Item{ Name: "Test Name", Created: time.Now(), }) If you add the boltHoldIndex struct tag to your type, BoltHold will automatically add and update an index for that field: type Person struct { Name string Division string `boltholdIndex:"Division"` } You can use chainable queries to retrieve, delete, or update records in the BoltHold database. bolthold.Where("FieldName").Eq(value).And("AnotherField").Lt(AnotherValue).Or(bolthold.Where("FieldName").Eq(anotherValue)) In my preliminary benchmarks, I'm finding that the cost of serialization plus index updates don't add any significant overhead compared to disk access (which is to be expected), and adding indexes can significant improve read speed because you can avoid unnecessary disk accesses, however, I haven't written a lot of benchmarks, so any feedback you guys have on how they can be improved to be more accurate, I'd love to hear. BenchmarkRawInsert-4 300 5351308 ns/op BenchmarkNoIndexInsert-4 300 5421718 ns/op BenchmarkIndexedInsert-4 300 5360532 ns/op BenchmarkNoIndexUpsert-4 300 5468971 ns/op BenchmarkIndexedUpsert-4 200 5700991 ns/op BenchmarkNoIndexInsertJSON-4 300 5555565 ns/op BenchmarkFindNoIndex-4 50 27340697 ns/op BenchmarkFindIndexed-4 3000 368265 ns/op It's a first release and the indexing and querying implementation is definitely what I would consider naive at this point, and I'm sure there are several improvements that can be made, however it's already proving to be a useful tool to me, and I'd love any feedback the community has to offer. There's lots more information in the README at https://github.com/timshannon/bolthold Thanks, -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.