Object/Trait

com.gu.scanamo

DynamoFormat

Related Docs: trait DynamoFormat | package scanamo

Permalink

object DynamoFormat extends EnumDynamoFormat with Serializable

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DynamoFormat
  2. Serializable
  3. Serializable
  4. EnumDynamoFormat
  5. DerivedDynamoFormat
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait AllOps[T] extends Ops[T]

    Permalink
  2. trait CoProductDynamoFormat[T] extends DynamoFormat[T]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  3. trait ConstructedDynamoFormat[T] extends AnyRef

    Permalink
    Definition Classes
    DerivedDynamoFormat
  4. trait InvalidConstructedDynamoFormat[T] extends ConstructedDynamoFormat[T]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  5. type NotSymbol[T] = <:!<[T, Symbol]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  6. trait Ops[T] extends AnyRef

    Permalink
  7. trait ToDynamoFormatOps extends AnyRef

    Permalink
  8. trait ValidConstructedDynamoFormat[T] extends ConstructedDynamoFormat[T]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  9. type ValidatedPropertiesError[T] = Validated[InvalidPropertiesError, T]

    Permalink
    Definition Classes
    DerivedDynamoFormat

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. implicit val BigDecimalSetFormat: DynamoFormat[Set[BigDecimal]]

    Permalink

    prop> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    prop> (s: Set[BigDecimal]) =>
        | val av = new AttributeValue().withNS(s.map(_.toString).toList: _*)
        | DynamoFormat[Set[BigDecimal]].write(s) == av &&
        |   DynamoFormat[Set[BigDecimal]].read(av) == Right(s)
  5. def apply[T](implicit instance: DynamoFormat[T]): DynamoFormat[T]

    Permalink
    Annotations
    @inline()
  6. implicit def arrayFormat[T](implicit arg0: ClassTag[T], f: DynamoFormat[T]): DynamoFormat[Array[T]]

    Permalink

    prop> (a: Array[String]) =>
        | DynamoFormat[Array[String]].read(DynamoFormat[Array[String]].write(a)).right.getOrElse(Array("error")).deep ==
        |   a.deep
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. implicit val bigDecimalFormat: DynamoFormat[BigDecimal]

    Permalink

    prop> (d: BigDecimal) =>
        | DynamoFormat[BigDecimal].read(DynamoFormat[BigDecimal].write(d)) == Right(d)
  9. implicit val booleanFormat: DynamoFormat[Boolean]

    Permalink

    prop> (b: Boolean) =>
        | DynamoFormat[Boolean].read(DynamoFormat[Boolean].write(b)) == Right(b)
  10. implicit val byteArrayFormat: DynamoFormat[Array[Byte]]

    Permalink

    prop> (ab:Array[Byte]) =>
        | DynamoFormat[Array[Byte]].read(DynamoFormat[Array[Byte]].write(ab)) == Right(ab)
  11. implicit val byteFormat: DynamoFormat[Byte]

    Permalink

    prop> (b: Byte) =>
        | DynamoFormat[Byte].read(DynamoFormat[Byte].write(b)) == Right(b)
  12. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. implicit val cnil: CoProductDynamoFormat[CNil]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  14. def coercedXmap[A, B, T >: Null <: Throwable](read: (B) ⇒ A)(write: (A) ⇒ B)(implicit f: DynamoFormat[B], T: ClassTag[T], NT: NotNull[T]): DynamoFormat[A]

    Permalink

    Returns a DynamoFormat for the case where A can always be converted B, with write, but read may throw an exception for some value of B

    Returns a DynamoFormat for the case where A can always be converted B, with write, but read may throw an exception for some value of B

    >>> import org.joda.time._
    
    >>> val jodaStringFormat = DynamoFormat.coercedXmap[LocalDate, String, IllegalArgumentException](
    ...   LocalDate.parse
    ... )(
    ...   _.toString
    ... )
    >>> jodaStringFormat.read(jodaStringFormat.write(new LocalDate(2007, 8, 18)))
    Right(2007-08-18)
    
    >>> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    >>> jodaStringFormat.read(new AttributeValue().withS("Togtogdenoggleplop"))
    Left(TypeCoercionError(java.lang.IllegalArgumentException: Invalid format: "Togtogdenoggleplop"))
  15. implicit def coproduct[K <: Symbol, V, T <: Coproduct](implicit headFormat: Lazy[DynamoFormat[V]], tailFormat: CoProductDynamoFormat[T], fieldWitness: Aux[K]): CoProductDynamoFormat[:+:[FieldType[K, V], T]]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  16. implicit val doubleFormat: DynamoFormat[Double]

    Permalink

    prop> (d: Double) =>
        | DynamoFormat[Double].read(DynamoFormat[Double].write(d)) == Right(d)
  17. implicit val doubleSetFormat: DynamoFormat[Set[Double]]

    Permalink

    prop> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    prop> (s: Set[Double]) =>
        | val av = new AttributeValue().withNS(s.map(_.toString).toList: _*)
        | DynamoFormat[Set[Double]].write(s) == av &&
        |   DynamoFormat[Set[Double]].read(av) == Right(s)
  18. implicit def enumDynamoFormatCCons[K <: Symbol, V, R <: Coproduct](implicit fieldWitness: Aux[K], emptyGeneric: Aux[V, HNil], alternativeFormat: EnumerationDynamoFormat[R]): EnumerationDynamoFormat[:+:[FieldType[K, V], R]]

    Permalink
    Definition Classes
    EnumDynamoFormat
  19. implicit val enumDynamoFormatCNil: EnumerationDynamoFormat[CNil]

    Permalink
    Definition Classes
    EnumDynamoFormat
  20. implicit def enumFormat[A, Repr <: Coproduct](implicit gen: Aux[A, Repr], genericFormat: EnumerationDynamoFormat[Repr]): EnumerationDynamoFormat[A]

    Permalink
    Definition Classes
    EnumDynamoFormat
  21. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  23. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. implicit def genericCoProduct[T, R](implicit gen: Aux[T, R], formatR: Lazy[CoProductDynamoFormat[R]]): DynamoFormat[T]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  25. implicit def genericProduct[T, R](implicit arg0: NotSymbol[T], gen: Aux[T, R], formatR: Lazy[ValidConstructedDynamoFormat[R]]): DynamoFormat[T]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  28. implicit def hcons[K <: Symbol, V, T <: HList](implicit headFormat: Lazy[DynamoFormat[V]], tailFormat: Lazy[ConstructedDynamoFormat[T]], fieldWitness: Aux[K]): ValidConstructedDynamoFormat[::[FieldType[K, V], T]]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  29. implicit val hnil: InvalidConstructedDynamoFormat[HNil]

    Permalink
    Definition Classes
    DerivedDynamoFormat
  30. implicit val intFormat: DynamoFormat[Int]

    Permalink

    prop> (i: Int) =>
        | DynamoFormat[Int].read(DynamoFormat[Int].write(i)) == Right(i)
  31. implicit val intSetFormat: DynamoFormat[Set[Int]]

    Permalink

    prop> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    prop> (s: Set[Int]) =>
        | val av = new AttributeValue().withNS(s.map(_.toString).toList: _*)
        | DynamoFormat[Set[Int]].write(s) == av &&
        |   DynamoFormat[Set[Int]].read(av) == Right(s)
  32. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  33. def iso[A, B](r: (B) ⇒ A)(w: (A) ⇒ B)(implicit f: DynamoFormat[B]): DynamoFormat[A]

    Permalink

    Returns a DynamoFormat for the case where A and B are isomorphic, i.e.

    Returns a DynamoFormat for the case where A and B are isomorphic, i.e. an A can always be converted to a B and vice versa.

    If there are some values of B that have no corresponding value in A, use DynamoFormat.xmap or DynamoFormat.coercedXmap.

    >>> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    
    >>> case class UserId(value: String)
    
    >>> implicit val userIdFormat =
    ...   DynamoFormat.iso[UserId, String](UserId.apply)(_.value)
    >>> DynamoFormat[UserId].read(new AttributeValue().withS("Eric"))
    Right(UserId(Eric))
  34. val javaListFormat: DynamoFormat[List[AttributeValue]]

    Permalink
  35. implicit def listFormat[T](implicit f: DynamoFormat[T]): DynamoFormat[List[T]]

    Permalink

    prop> (l: List[String]) =>
        | DynamoFormat[List[String]].read(DynamoFormat[List[String]].write(l)) ==
        |   Right(l)
  36. implicit val longFormat: DynamoFormat[Long]

    Permalink

    prop> (l: Long) =>
        | DynamoFormat[Long].read(DynamoFormat[Long].write(l)) == Right(l)
  37. implicit val longSetFormat: DynamoFormat[Set[Long]]

    Permalink

    prop> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    prop> (s: Set[Long]) =>
        | val av = new AttributeValue().withNS(s.map(_.toString).toList: _*)
        | DynamoFormat[Set[Long]].write(s) == av &&
        |   DynamoFormat[Set[Long]].read(av) == Right(s)
  38. implicit def mapFormat[V](implicit f: DynamoFormat[V]): DynamoFormat[Map[String, V]]

    Permalink

    prop> (m: Map[String, Int]) =>
        | DynamoFormat[Map[String, Int]].read(DynamoFormat[Map[String, Int]].write(m)) ==
        |   Right(m)
  39. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  40. object nonInheritedOps extends ToDynamoFormatOps

    Permalink
  41. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  42. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  43. object ops

    Permalink
  44. implicit def optionFormat[T](implicit f: DynamoFormat[T]): DynamoFormat[Option[T]] { val default: Some[None.type] }

    Permalink

    prop> (o: Option[Long]) =>
        | DynamoFormat[Option[Long]].read(DynamoFormat[Option[Long]].write(o)) ==
        |   Right(o)
    
    >>> DynamoFormat[Option[Long]].read(new com.amazonaws.services.dynamodbv2.model.AttributeValue().withNULL(true))
    Right(None)
  45. implicit def seqFormat[T](implicit f: DynamoFormat[T]): DynamoFormat[Seq[T]]

    Permalink

    prop> (sq: Seq[String]) =>
        | DynamoFormat[Seq[String]].read(DynamoFormat[Seq[String]].write(sq)) ==
        |   Right(sq)
  46. implicit val shortFormat: DynamoFormat[Short]

    Permalink

    prop> (s: Short) =>
        | DynamoFormat[Short].read(DynamoFormat[Short].write(s)) == Right(s)
  47. implicit def someFormat[T](implicit f: DynamoFormat[T]): DynamoFormat[Some[T]]

    Permalink

    This ensures that if, for instance, you specify an update with Some(5) rather than making the type of Option explicit, it doesn't fall back to auto-derivation

  48. implicit val stringFormat: DynamoFormat[String]

    Permalink

    prop> (s: String) =>
        | DynamoFormat[String].read(DynamoFormat[String].write(s)) == Right(s)
  49. implicit val stringSetFormat: DynamoFormat[Set[String]]

    Permalink

    prop> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    prop> (s: Set[String]) =>
        | val av = new AttributeValue().withSS(s.toList: _*)
        | DynamoFormat[Set[String]].write(s) == av &&
        |   DynamoFormat[Set[String]].read(av) == Right(s)
  50. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  51. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  52. implicit val uuidFormat: DynamoFormat[UUID]

    Permalink

    prop> implicit val arbitraryUUID = org.scalacheck.Arbitrary(org.scalacheck.Gen.uuid)
    prop> (uuid: java.util.UUID) =>
        | DynamoFormat[java.util.UUID].read(DynamoFormat[java.util.UUID].write(uuid)) ==
        |   Right(uuid)
  53. implicit def vectorFormat[T](implicit f: DynamoFormat[T]): DynamoFormat[Vector[T]]

    Permalink

    prop> (v: Vector[String]) =>
        | DynamoFormat[Vector[String]].read(DynamoFormat[Vector[String]].write(v)) ==
        |   Right(v)
  54. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. def xmap[A, B](r: (B) ⇒ Either[DynamoReadError, A])(w: (A) ⇒ B)(implicit f: DynamoFormat[B]): DynamoFormat[A]

    Permalink

    >>> import org.joda.time._
    >>> import com.amazonaws.services.dynamodbv2.model.AttributeValue
    
    >>> implicit val jodaLongFormat = DynamoFormat.xmap[DateTime, Long](
    ...   l => Right(new DateTime(l).withZone(DateTimeZone.UTC))
    ... )(
    ...   _.withZone(DateTimeZone.UTC).getMillis
    ... )
    >>> DynamoFormat[DateTime].read(new AttributeValue().withN("0"))
    Right(1970-01-01T00:00:00.000Z)

Inherited from Serializable

Inherited from Serializable

Inherited from EnumDynamoFormat

Inherited from DerivedDynamoFormat

Inherited from AnyRef

Inherited from Any

Ungrouped