Releases: albrow/zoom
Version 0.19.1
This release fixes a small error in the README documentation. Thanks @ozburo for noticing the error and submitting a PR.
Version 0.19.0
The main purpose of this release is to address #27, but there are also many other small changes to improve code quality and satisfy gometalinter.
Because the linter requires changing some exported identifiers from Id
to ID
, this is a breaking change and is not backwards-compatible. However, there are no behavior changes and upgrading should be pretty straightforward.
Full Changelog
Model.ModelId
renamed toModel.ModelID
.Model.SetModelId
renamed toModel.SetModelID
.RandomId
renamed toRandomID
.Query.Ids
renamed toQuery.IDs
.Query.StoreIds
renamed toQuery.StoreIDs
.Transaction.ExtractIdsFromFieldIndex
renamed toTransaction.ExtractIDsFromFieldIndex
.Transaction.ExtractIdsFromStringIndex
renamed toTransaction.ExtractIDsFromStringIndex
.Transaction.DeleteModelsBySetIds
renamed toTransaction.DeleteModelsBySetIDs
.Transaction.Ids
renamed toTransaction.IDs
.Transaction.StoreIds
renamed toTransaction.StoreIDs
.- Updated CONTRIBUTING.md with simplified instructions for pull requests.
- Various other typo fixes and code style improvements which do not affect exported identifiers.
Version 0.18.0
This release introduces one major feature (optimistic locking!), as well as a few smaller features and documentation improvements.
Optimistic locking has finally been implemented :) We use the Redis WATCH
command under the hood for a solution that is simple and performs well. There are two functionally similar methods on Transaction
: Watch
which expects a Model
, and WatchKey
which expects a Redis key. You can learn more about how it works by reading the examples in the README and the documentation.
One other small feature that's been introduced is the Exists
method on Collection
and Transaction
which allows you to easily check if a model with a specific key exists. The only way to do this previously was to call Find
and check for a ModelNotFoundError
.
This release is mostly backwards compatible with version 0.17.0. The only exception is that your code may break if you were relying on some methods and types which were removed or unexported (see below).
Full Changelog
- Implemented optimistic locking via the new methods
Watch
andWatchKey
. - Implemented
Collection.Exists
andTransaction.Exists
for quickly determining whether a model with a specific id exists. - Fixed some small typos in README and doc comments.
- Removed the
Transaction.FindModelsByIdsKey
as I believe it is too complicated and unlikely to be used. We can always add it back later. - Unexported
actionKind
,commandAction
, andscriptAction
as they were never really meant to be exported in the first place.
Version 0.17.0
This release features some bug fixes, API changes, and new features. It is not backwards compatible with previous versions.
You can now run queries inside a transaction via the Transaction.Query
method. It returns a TransactionQuery
type which works similarly to a regular Query
. The only real difference is how the queries are actually executed. Specifically, the finisher methods (e.g. Run
, RunOne
, Count
, etc) do not return anything. Instead they accept arguments which are then mutated after the transaction is executed with Transaction.Exec
.
There is a new query finisher method called StoreIds
on both Query
and TransactionQuery
. StoreIds
allows you to store the ids of models that match the query criteria in a Redis list, which allows for more low-level operations.
Zoom now uses a different approach for both PoolOptions
and CollectionOptions
. In the past, Zoom has relied on zero types and nil
to implicitly convey defaults. Now, Zoom explicitly provides values for DefaultPoolOptions
and DefaultCollectionOptions
. To modify the options, you can create a copy of the options and modify the fields directly. There are also helper methods (e.g. PoolOptions.WithPassword
for modifying the default values without mutating.
Full Changelog
- Added new
StoreIds
method toQuery
andTransactionQuery
- Added an explicit test for leaked temporary ids
- Implemented
TransactionQuery
for running queries inside a transaction - Implemented
Transaction.FindModelsByIdsKey
for finding models by the ids in a Redis set - Fixed a bug which caused fields of type
time.Duration
to not be saved correctly - Improved clarity of the
ModelNotFoundError
message - Fixed a bug where errors that occurred during a transaction were sometimes not returned
- Renamed
UpdateFields
toSaveFields
- Changed the way
PoolOptions
andCollectionOptions
work - Various README updates
Version 0.16.0
This release focuses on improving flexibility and enabling more advanced usage. A number of methods, functions, and other identifiers which were previously unexported are now exported and documented. For a complete description of the new functions and methods, check the full documentation at godoc.org/albrow/zoom.
This release is not backwards compatible with previous releases due to a small change to the Collection.ModelKey
method. Previously, the method had a signature like func (*Collection) ModelKey(id string) (string, error)
would return an error if you passed in an empty string. The new implementation has only one return value (a string
) and returns an empty string if you pass in an empty string. However this change is not expected to affect many users.
Full Changelog:
- Exported commonly used
ReplyHandler
s (e.g.NewScanIntHandler
, which will scan the reply value into an integer).- Exported useful Lua scripts in the form of a wrapper function (e.g.
Transaction.ExtractIdsFromFieldIndex
). - Added link to a new
people
repository which serves as an example of how to use Zoom in an HTTP/JSON API. - Removed the error return value from
Collection.ModelKey
. - Removed glide.lock and glide.yaml due to complications arising from checking in the vendor folder and the possibility of duplicated vendored packages. The recommended strategy for users of Zoom is now to vendor dependencies yourself.
- Exported useful Lua scripts in the form of a wrapper function (e.g.
Version 0.15.1
This release fixes a bug that caused applications of the Order
query modifier to sometimes return nil
. If you chained Order
together with other query modifiers, this could lead to an error:
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
This fix is 100% backwards compatible with version 0.15.0.
Full Changelog
- Fixed a bug in
Order
that could sometimes cause nil pointers.
Version 0.15.0
This version updates the usage of reflect to be compatible with the upcoming go 1.6 release. All the tests pass both with go 1.5.3 and go 1.6-beta-2. This release also includes changes in the README and comments in the source code to disambiguate on the treatment of unexported embedded structs with exported fields.
This release is not backwards compatible with any previous versions, because it does not attempt to save unexported embedded structs with exported fields. However, as far as I know, previous versions would always return an error if you tried to do this. In practice, I would be surprised if this release breaks any code that was using the previous versions.
Full Changelog
- Verified compatibility with the upcoming go 1.6 release.
- Unexported embedded structs with exported fields are now ignored, not saved. (Previous releases may have returned an error).
- Improved README regarding unexported embedded structs with exported fields.
- Added tests for unexported embedded structs with exported fields.
Version 0.14.2
This release effectively reverts version 0.14.1. I discovered another problem that caused go get
to fail. Vendoring does not currently work, but the library should still work okay as long as none of the dependencies introduce incompatible changes.
Full Changelog
- Remove vendor folder from version control
Version 0.14.1
This release fixes a bug introduced by 0.14.0 which prevented vendoring from working correctly. Vendored dependencies are now committed to version control using submodules and are still managed by Glide. Zoom should now work correctly with git and the go get
command.
Git submodules can be confusing and come with their own set of commands. I initially tried to avoid using them. However, it is the only way I could figure out how to get the vendored dependencies to install and work as expected. Fortunately, you should not ever need to know anything about git submodules in order to use Zoom effectively. Even if you contribute, the glide get
and glide install
commands will be used to manage versions and you should not need to interact with submodules directly.
Changelog
- Fix a bug which caused vendoring to not work correctly
- Elaborate on vendoring in CONTRIBUTING.md
Version 0.14.0
This release contains a few very minor code changes to improve error messages. This is also the first release which uses Glide to manage dependencies and install them to the vendor
folder. Additionally, the benchmark results were updated for the hardware I currently have available. Unfortunately, I will be unable to run the benchmarks on my old hardware for comparison in the future.
NOTE: this release actually contains a bug which prevents vendoring from working correctly and is fixed in version 0.14.1.
Full Changelog
- Zoom now uses Glide and the Go vendor experiment to manage dependencies
- Updated benchmark results in README
- Improved error message when attempting to call a method on a nil
Collection