sealed trait Value extends AnyRef

A FaunaDB value.

Reference: Fauna Data Types

Overview

Value is an algebraic data type that represents the value of possible FaunaDB query responses. While it is possible to extract data out of a Value object using pattern matching, the faunadb.values.Field lets you create more complex and reusable data extractors.

// Simple, adhoc extraction:
value("data", "name").to[String].get

// Using a reusable Field:
val NameField = Field("data", "name").to[String]
value(NameField).get

Extraction can be composed:

val refAndNameAndAge = for {
  ref <- value("ref").to[RefV]
  name <- value("data", "name").to[String]
  age <- value("data", "age").to[Int]
} yield (ref, name, age)

refAndNameAndAge.get

// or

val RefAndNameAndAgeField = Field.zip(
  Field("ref").to[RefV],
  Field("data", "name").to[String],
  Field("data", "age").to[Int])

value(RefAndNameAndAgeField).get

If a value may be an array, or may contain an array, the array's elements may be cast using collect:

value("data", "tags").collect(Field.to[String]).get

// or

val TagsField = Field("data", "tags").collect(Field.to[String])
value(TagsField).get
Annotations
@JsonDeserialize()
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Value
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. final def apply(p: FieldPath, ps: FieldPath*): Result[Value]

    Extract the sub-value at the specified path.

  5. final def apply[T](field: Field[T]): Result[T]

    Extract a value with the provided field.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  8. final def collect[T](field: Field[T]): Result[Seq[T]]

    Extract the elements of an ArrayV using the provided field.

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  18. final def to[T](implicit arg0: Decoder[T]): Result[T]

    Cast the value to T, using a Decoder.

  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

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

Inherited from AnyRef

Inherited from Any

Ungrouped