Skip to content

Version 0.13.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@albrow albrow released this 20 Oct 21:36
· 71 commits to master since this release

This version introduces some new features which make Zoom more flexible without sacrificing simplicity. It is 100% backwards compatible with versions 0.12.x and 0.11.x.

There is a new FindFields method on Collection and Transaction which works similarly to UpdateFields. It allows you to efficiently find and set only certain fields of a model. See the README for example usage.

Zoom now exposes the fallback encoding used to encode objects which cannot easily be converted to bytes. You can choose the fallback encoding by setting the FallbackMarshalerUnmarshaler option in CollectionOptions. By default, Zoom will use GobMarshalerUnmarshaler, which uses the builtin gob package. This is the same encoding that has always been used by default. Now, Zoom also provides an alternative implementation out of the box, JSONMarshalerUnmarshaler, which as you might have guessed uses the builtin json package. You can also provide your own implementation by implementing the MarshalerUnmarshaler interface:

type MarshalerUnmarshaler interface {
    // Marshal returns a byte-encoded representation of v
    Marshal(v interface{}) ([]byte, error)
    // Unmarshal parses byte-encoded data and store the result in the value
    // pointed to by v.
    Unmarshal(data []byte, v interface{}) error
}

Full Changelog

  • Added a new FindFields method to Collection and Transaction.
  • Added a new FallbackMarshalerUnmarshaler option to CollectionOptions.
  • Created two out of the box implementations of MarshalerUnmarshaler: GobMarshalerUnmarshaler (the default) and JSONMarshalerUnmarshaler.