Packages

p

stamina

migrations

package migrations

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. migrations
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type Migration[T] = (T) ⇒ T

    A Migration[T] is a simple type alias for a function that takes a T and produces another T, usually the input value transformed in some way in order to make it compatible with a higher version.

  2. implicit final class MigrationWithComposition[T] extends AnyVal

    Adds support for combining two instances of Migration[T] into a new Migration[T] that will apply the first one and then the second one.

  3. class Migrator[R, V <: Version] extends AnyRef

    A Migrator[R, V] can migrate raw values of type R from older versions to version V by applying a specific Migration[R] to it.

    A Migrator[R, V] can migrate raw values of type R from older versions to version V by applying a specific Migration[R] to it.

    You can create instances of Migrator[R, V] by using a small type-safe DSL consisting of two parts: the from[R, V1] function will create a Migrator[R, V1] and then you can use the to[V](migration: Migration[R]) function to build instances that can migrate multiple versions.

    R

    The type of raw data being migrated. In the JSON implementation this would be JsValue.

    V

    The "current" version of this Migrator, i.e. it can migrate values from V1 to this version or any version in between.

    Example:
    1. Using the json implementation:

      val p = persister[CartCreated, V3]("cart-created",
        from[JsValue, V1]
          .to[V2](_.update('cart / 'items / * / 'price ! set[Int](1000)))
          .to[V3](_.update('timestamp ! set[Long](System.currentTimeMillis - 3600000L)))
      )
  4. case class UndefinedMigrationException(fromVersion: Int, toVersion: Int) extends RuntimeException with Product with Serializable

    Runtime exception for signalling that the specified migration path is not supported.

Value Members

  1. def from[T, V <: V1](implicit arg0: VersionInfo[V]): Migrator[T, V]

    Creates a Migrator[T, V1] that can function as a builder for creating Migrator[T, V2], etc.

    Creates a Migrator[T, V1] that can function as a builder for creating Migrator[T, V2], etc. Its migration will be the identity function so calling its migrate function will not have any effect.

  2. def identityMigration[T]: Migration[T]

    The identity Migration will always return its input as its output.

Inherited from AnyRef

Inherited from Any

Ungrouped