Closed ivard closed 5 years ago
Yeah the assumption was that only one encoder would ever be used.
Basically what you're looking for is for the encoder/decoder to set and tracked on a per store basis right? You'd still set it as part of the options when you open the store. So the API wouldn't change.
Yes exactly. The options are indeed already passed to each store independently, so that wouldn't have to change. The confusing element in my experience was that the options parameter gives the impression that options can differ over multiple stores. Therefore I was quite surprised of the actual behavior.
Fixed in #70
When specifying another encoder or decoder when opening a bolthold database, the encoder or decoder is changed globally over the project. This is a problem if you use multiple bolthold databases at the same time. For example, we use bolthold in our main application and one of the libraries we use in our tests also uses bolthold. The library however uses another encoder and decoder than we do.
A consequence of this is that as as soon as the library opens its database and changes the decoder, the database in our main application cannot be used anymore. It gives an error that information cannot be encoded or decoded anymore.
In the following code you can see that the encoder and decoder are set globally over the project: https://github.com/timshannon/bolthold/blob/525de816b1a2c1cfbb67b5e9936a6b76e0c7f3e6/encode.go#L18-L19