Packages

  • package root
    Definition Classes
    root
  • package meteor
    Definition Classes
    root
  • trait syntax extends AnyRef

    Utility to help writing meteor.codec.Codec, meteor.codec.Encoder and meteor.codec.Decoder.

    Utility to help writing meteor.codec.Codec, meteor.codec.Encoder and meteor.codec.Decoder.

    Examples:

    import meteor.syntax._
    import meteor.codec._
    
    case class Author(
      names: String,
      age: Int
    )
    
    case class Book(
      name: String,
      author: Author,
      coAuthor: Option[Author]
    )
    
    implicit val encoderForAuthor: Encoder[Author] = Encoder.instance { obj =>
      Map(
        "names" -> obj.names.asAttributeValue,
        "age" -> obj.age.asAttributeValue
      ).asAttributeValue
    }
    
    implicit val encoderForBook: Encoder[Book] = Encoder.instance { obj =>
      Map(
        "name" -> obj.names.asAttributeValue,
        "author" -> obj.age.asAttributeValue,
        "coAuthor" -> obj.age.asAttributeValue,
      ).asAttributeValue
    }
    
    implicit val decoderForAuthor: Decoder[Author] = Decoder.instance { av =>
      for {
        names <- av.getAs[String]("names")
        age <- av.getAs[Int]("age")
      } yield Author(names, age)
    }
    
    implicit val decoderForBook: Decoder[Book] = Decoder.instance { av =>
      for {
        name <- av.getAs[String]("name")
        author <- av.getAs[Author]("author")
        coAuthor <- av.getOpt[Author]("coAuthor")
      } yield Book(name, author, coAuthor)
    }
    Definition Classes
    meteor
  • RichReadAttributeValue
  • RichWriteAttributeValue
c

meteor.syntax

RichReadAttributeValue

implicit class RichReadAttributeValue extends AnyRef

Provide extension method(s) to read from a Java AttributeValue

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

Instance Constructors

  1. new RichReadAttributeValue(av: AttributeValue)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def as[A](implicit arg0: Decoder[A]): Either[DecoderError, A]

    Attempt to read the AttributeValue as a value of type A or DecoderError

    Attempt to read the AttributeValue as a value of type A or DecoderError

    Note: if the value of the AttributeValue is nullable, use asOpt instead.

    returns

    either a value of type A or DecoderError

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def asOpt[A](implicit arg0: Decoder[A]): Either[DecoderError, Option[A]]

    Attempt to read the AttributeValue as an optional value of type A or DecoderError.

    Attempt to read the AttributeValue as an optional value of type A or DecoderError. This should be used when AttributeValue can be NULL.

    returns

    either an optional value of type A or DecoderError

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def get(key: String): Either[DecoderError, AttributeValue]

    Attempt to treat the AttributeValue as of type M, retrieve value by a given key as an AttributeValue.

    Attempt to treat the AttributeValue as of type M, retrieve value by a given key as an AttributeValue.

    key

    the key whose associated value is to be returned

    returns

    either a value as AttributeValue type or DecoderError

  11. def getAs[A](key: String)(implicit arg0: Decoder[A]): Either[DecoderError, A]

    Attempt to treat the AttributeValue as of type M, retrieve AttributeValue that associated to a given key and attempt reading it to a value of type A.

    Attempt to treat the AttributeValue as of type M, retrieve AttributeValue that associated to a given key and attempt reading it to a value of type A.

    Note: if the returning AttributeValue is nullable, use getOpt instead.

    key

    the key whose associated value is to be returned

    returns

    either a value of type A type or DecoderError

  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  13. def getOpt[A](key: String)(implicit arg0: Decoder[A]): Either[DecoderError, Option[A]]

    Attempt to treat the AttributeValue as of type M, retrieve AttributeValue that associated to a given key and attempt reading it to an optional value of type A.

    Attempt to treat the AttributeValue as of type M, retrieve AttributeValue that associated to a given key and attempt reading it to an optional value of type A. This should be used when the returning AttributeValue can be NULL.

    key

    the key whose associated value is to be returned

    returns

    either a value of type A type or DecoderError

  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped