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()
- Alphabetic
- By Inheritance
- Value
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
apply(p: FieldPath, ps: FieldPath*): Result[Value]
Extract the sub-value at the specified path.
-
final
def
apply[T](field: Field[T]): Result[T]
Extract a value with the provided field.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
collect[T](field: Field[T]): Result[Seq[T]]
Extract the elements of an ArrayV using the provided field.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
to[T](implicit arg0: Decoder[T]): Result[T]
Cast the value to T, using a Decoder.
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )