Trait/Object

faunadb.values

Value

Related Docs: object Value | package values

Permalink

sealed trait Value extends AnyRef

A FaunaDB value.

Reference: FaunaDB Values

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
Known Subclasses
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

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

    Permalink

    Extract the sub-value at the specified path.

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

    Permalink

    Extract a value with the provided field.

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def collect[T](field: Field[T]): Result[Seq[T]]

    Permalink

    Extract the elements of an ArrayV using the provided field.

  9. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. final def to[T](implicit arg0: Decoder[T]): Result[T]

    Permalink

    Cast the value to T, using a Decoder.

  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped