Object/Trait

org.scanamo

DynamoFormat

Related Docs: trait DynamoFormat | package scanamo

Permalink

object DynamoFormat extends LowPriorityFormats

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

Type Members

  1. trait ObjectFormat[T] extends DynamoFormat[T]

    Permalink

    DynamoFormats for object-like structures

    DynamoFormats for object-like structures

    Note

    All data types used as the carrier type in Table operations should derive an instance from this class

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 org.scalacheck._
    prop> implicit def arbNonEmptySet[T: Arbitrary] = Arbitrary(Gen.nonEmptyContainerOf[Set, T](Arbitrary.arbitrary[T]))
    
    prop> (s: Set[BigDecimal]) =>
        | val av = DynamoValue.fromNumbers(s)
        | DynamoFormat[Set[BigDecimal]].write(s) == av &&
        |   DynamoFormat[Set[BigDecimal]].read(av) == Right(s)
    
    >>> DynamoFormat[Set[BigDecimal]].write(Set.empty).isNull
    true
  5. object ObjectFormat

    Permalink
  6. def apply[T](implicit D: DynamoFormat[T]): DynamoFormat[T]

    Permalink
  7. 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")).toList ==
        |   a.toList
  8. final def asInstanceOf[T0]: T0

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

    Permalink

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

    Permalink

    prop> (b: Boolean) =>
        | DynamoFormat[Boolean].read(DynamoFormat[Boolean].write(b)) == Right(b)
  11. def build[T](r: (DynamoValue) ⇒ Either[DynamoReadError, T], w: (T) ⇒ DynamoValue): DynamoFormat[T]

    Permalink
  12. implicit val byteArrayFormat: DynamoFormat[Array[Byte]]

    Permalink

    prop> (ab:Array[Byte]) =>
        | DynamoFormat[Array[Byte]].read(DynamoFormat[Array[Byte]].write(ab)) == Right(ab)
  13. implicit val byteBufferFormat: DynamoFormat[ByteBuffer]

    Permalink
  14. implicit val byteFormat: DynamoFormat[Byte]

    Permalink

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. def coercedXmap[A, B, T >: Null <: Throwable](read: (B) ⇒ A)(write: (A) ⇒ B)(implicit arg0: DynamoFormat[B], arg1: ClassTag[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)
    
    >>> jodaStringFormat.read(DynamoValue.fromString("Togtogdenoggleplop"))
    Left(TypeCoercionError(java.lang.IllegalArgumentException: Invalid format: "Togtogdenoggleplop"))
  17. implicit val doubleFormat: DynamoFormat[Double]

    Permalink

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

    Permalink

    prop> import org.scalacheck._
    prop> implicit def arbNonEmptySet[T: Arbitrary] = Arbitrary(Gen.nonEmptyContainerOf[Set, T](Arbitrary.arbitrary[T]))
    
    prop> (s: Set[Double]) =>
        | val av = DynamoValue.fromNumbers(s)
        | DynamoFormat[Set[Double]].write(s) == av &&
        |   DynamoFormat[Set[Double]].read(av) == Right(s)
    
    >>> DynamoFormat[Set[Double]].write(Set.empty).isNull
    true
  19. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  21. implicit final def exportedFormat[A](implicit E: ExportedDynamoFormat[A]): DynamoFormat[A]

    Permalink
    Definition Classes
    LowPriorityFormats
  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. implicit val floatFormat: DynamoFormat[Float]

    Permalink

    prop> (d: Float) =>
        | DynamoFormat[Float].read(DynamoFormat[Float].write(d)) == Right(d)
  24. implicit val floatSetFormat: DynamoFormat[Set[Float]]

    Permalink

    prop> import org.scalacheck._
    prop> implicit def arbNonEmptySet[T: Arbitrary] = Arbitrary(Gen.nonEmptyContainerOf[Set, T](Arbitrary.arbitrary[T]))
    
    prop> (s: Set[Float]) =>
        | val av = DynamoValue.fromNumbers(s)
        | DynamoFormat[Set[Float]].write(s) == av &&
        |   DynamoFormat[Set[Float]].read(av) == Right(s)
    
    >>> DynamoFormat[Set[Float]].write(Set.empty).isNull
    true
  25. implicit def genericSet[T](implicit arg0: DynamoFormat[T]): DynamoFormat[Set[T]]

    Permalink

    prop> (s: Set[Boolean]) =>
        | DynamoFormat[Set[Boolean]].read(DynamoFormat[Set[Boolean]].write(s)) ==
        |   Right(s)
  26. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  28. implicit val instantAsLongFormat: DynamoFormat[Instant]

    Permalink

    Format for dealing with points in time stored as the number of milliseconds since Epoch.

    Format for dealing with points in time stored as the number of milliseconds since Epoch.

    prop> import org.scanamo.DynamoFormat
    prop> import java.time.Instant
    prop> import org.scanamo.TimeGenerators.instantAsLongArb
    prop> (x: Instant) =>
        | DynamoFormat[Instant].read(DynamoFormat[Instant].write(x)) == Right(x)
  29. implicit val intFormat: DynamoFormat[Int]

    Permalink

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

    Permalink

    prop> import org.scalacheck._
    prop> implicit def arbNonEmptySet[T: Arbitrary] = Arbitrary(Gen.nonEmptyContainerOf[Set, T](Arbitrary.arbitrary[T]))
    
    prop> (s: Set[Int]) =>
        | val av = DynamoValue.fromNumbers(s)
        | DynamoFormat[Set[Int]].write(s) == av &&
        |   DynamoFormat[Set[Int]].read(av) == Right(s)
    
    >>> DynamoFormat[Set[Int]].write(Set.empty).isNull
    true
  31. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  32. 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.

    >>> case class UserId(value: String)
    
    >>> implicit val userIdFormat =
    ...   DynamoFormat.iso[UserId, String](UserId.apply, _.value)
    >>> DynamoFormat[UserId].read(DynamoValue.fromString("Eric"))
    Right(UserId(Eric))
  33. implicit val javaListFormat: DynamoFormat[List[DynamoValue]]

    Permalink
  34. 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)
  35. implicit val longFormat: DynamoFormat[Long]

    Permalink

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

    Permalink

    prop> import org.scalacheck._
    prop> implicit def arbNonEmptySet[T: Arbitrary] = Arbitrary(Gen.nonEmptyContainerOf[Set, T](Arbitrary.arbitrary[T]))
    
    prop> (s: Set[Long]) =>
        | val av = DynamoValue.fromNumbers(s)
        | DynamoFormat[Set[Long]].write(s) == av &&
        |   DynamoFormat[Set[Long]].read(av) == Right(s)
    
    >>> DynamoFormat[Set[Long]].write(Set.empty).isNull
    true
  37. 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)
  38. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  39. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  41. implicit val offsetDateTimeFormat: DynamoFormat[OffsetDateTime]

    Permalink

    Format for dealing with date-times with an offset from UTC.

    Format for dealing with date-times with an offset from UTC.

    prop> import org.scanamo.DynamoFormat
    prop> import java.time.OffsetDateTime
    prop> import org.scanamo.TimeGenerators.offsetDateTimeArb
    prop> (x: OffsetDateTime) =>
        | DynamoFormat[OffsetDateTime].read(DynamoFormat[OffsetDateTime].write(x)) == Right(x)
  42. implicit def optionFormat[T](implicit f: DynamoFormat[T]): DynamoFormat[Option[T]]

    Permalink

    prop> (o: Option[Long]) =>
        | DynamoFormat[Option[Long]].read(DynamoFormat[Option[Long]].write(o)) ==
        |   Right(o)
    
    >>> DynamoFormat[Option[Long]].read(DynamoValue.nil)
    Right(None)
    
    >>> DynamoFormat[Option[Long]].write(None).isNull
    true
  43. 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)
  44. implicit val shortFormat: DynamoFormat[Short]

    Permalink

    prop> (s: Short) =>
        | DynamoFormat[Short].read(DynamoFormat[Short].write(s)) == Right(s)
  45. 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

  46. implicit val stringFormat: DynamoFormat[String]

    Permalink

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

    Permalink

    prop> import org.scalacheck._
    prop> implicit val arbSet = Arbitrary(Gen.nonEmptyContainerOf[Set, String](Arbitrary.arbitrary[String]))
    
    prop> (s: Set[String]) =>
        | val av = DynamoValue.fromStrings(s)
        | DynamoFormat[Set[String]].write(s) == av &&
        |   DynamoFormat[Set[String]].read(av) == Right(s)
    
    >>> DynamoFormat[Set[String]].write(Set.empty).isNull
    true
  48. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

    Permalink

    prop> (uuid: java.util.UUID) =>
        | DynamoFormat[java.util.UUID].read(DynamoFormat[java.util.UUID].write(uuid)) ==
        |   Right(uuid)
  51. 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)
  52. final def wait(): Unit

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

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

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

    Permalink

    >>> import org.joda.time._
    
    >>> implicit val jodaLongFormat = DynamoFormat.xmap[DateTime, Long](
    ...   l => Right(new DateTime(l).withZone(DateTimeZone.UTC))
    ... )(
    ...   _.withZone(DateTimeZone.UTC).getMillis
    ... )
    >>> DynamoFormat[DateTime].read(DynamoValue.fromNumber(0L))
    Right(1970-01-01T00:00:00.000Z)
  56. implicit val zonedDateTimeFormat: DynamoFormat[ZonedDateTime]

    Permalink

    Format for dealing with date-times with a time zone in the ISO-8601 calendar system.

    Format for dealing with date-times with a time zone in the ISO-8601 calendar system.

    prop> import org.scanamo.DynamoFormat
    prop> import java.time.ZonedDateTime
    prop> import org.scanamo.TimeGenerators.zonedDateTimeArb
    prop> (x: ZonedDateTime) =>
        | DynamoFormat[ZonedDateTime].read(DynamoFormat[ZonedDateTime].write(x)) == Right(x)

Inherited from LowPriorityFormats

Inherited from AnyRef

Inherited from Any

Ungrouped