An implementation of the stamina Persister that will use spray-json to read/write serialized values.
An implementation of the stamina Persister that will use spray-json to read/write serialized values. It supports a DSL for specifying migrations to apply to older versions of persisted values to bring them up to date with the latest version.
The DSL allows for any migration function that can transform an instance of JsValue to another, migrated instance of JsValue but by far the best way to implement these migration functions is to use the json-lenses library that comes with spray-json.
val p = persister[CartCreated, V3]("cart-created", from[V1] .to[V2](_.update('cart / 'items / * / 'price ! set[Int](1000))) .to[V3](_.update('timestamp ! set[Long](System.currentTimeMillis - 3600000L))) )