Version 0.18.0
Pre-releaseThis 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.