An Array.
A Boolean value.
A Date value.
A Double value.
A Long value.
The Null value.
An Object value.
A Ref.
Base trait for all scalar values.
A Set Ref.
A String value.
A Timestamp value.
A FaunaDB value.
A FaunaDB value.
Reference: FaunaDB Values
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
Companion object to the Value trait.
Base trait for all scalar values.
Arrays, objects, and null are not considered scalar values.