Warning:
Fauna is decommissioning FQL v4 on June 30, 2025.

This driver is not compatible with FQL v10, the latest version. Fauna accounts created after August 21, 2024 must use FQL v10.
Ensure you migrate existing projects to the official v10 driver by the v4 EOL date: https://github.com/fauna/fauna-jvm.

For more information, see the v4 end of life (EOL) announcement and related FAQ.

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
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[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  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. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. final def to[T](implicit arg0: Decoder[T]): Result[T]

    Cast the value to T, using a Decoder.

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

Inherited from AnyRef

Inherited from Any

Ungrouped