|
The Bytes type denotes a Base64-encoded string representing a byte
array.
client.Query(
new byte[] { 0x1, 0x2, 0x3 }
);
System.out.println(
client.query(
Value(new byte[]{ 0x1, 0x2, 0x3 })
).get());
result, err := client.Query(
f.BytesV{0x1, 0x2, 0x3})
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
client.query(Array[Byte](0x1, 0x2, 0x3))
result = client.query(
bytearray(b'\x01\x02\x03')
)
print(result)
client.query(
new Uint8Array([0x1, 0x2, 0x3])
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
bytearray(b'\x01\x02\x03')
|
|
The Date type denotes a date, with no associated time zone.
client.Query(
Date("1970-01-01")
);
System.out.println(
client.query(
Date(Value("1970-01-01"))
).get());
result, err := client.Query(
f.Date("1970-01-01"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
client.query(Date("1970-01-01"))
result = client.query(
q.date("1970-01-01")
)
print(result)
client.query(
q.Date('1970-01-01')
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
FaunaDate(1970-01-01 12:00:00 AM)
Functions that operate on times or dates:
Date
|
Converts an ISO-8601 string into a Date.
|
DayOfMonth
|
Returns the day of the month from a timestamp.
|
DayOfWeek
|
Returns the day of the week from a timestamp.
|
DayOfYear
|
Returns the day of the year from a timestamp.
|
Epoch
|
Creates a timestamp from an offset since 1970-01-01 in seconds,
milliseconds, microseconds, or nanoseconds.
|
Hour
|
Returns the hour from a timestamp.
|
Minute
|
Returns the minute from a timestamp.
|
Month
|
Returns the month from a timestamp.
|
Now
|
Returns a timestamp representing the current transaction time.
|
Second
|
Returns the second from a timestamp.
|
Time
|
Converts now , or an ISO-8601 string, into a timestamp.
|
TimeAdd
|
Adds an offset to a provided timestamp/date.
|
TimeDiff
|
Returns the difference between two timestamps/dates, in specified
units.
|
TimeSubtract
|
Subtracts an offset from a provided timestamp/date.
|
Year
|
Returns the year from a timestamp.
|
|
|
A Page contains an array of results and other decorated elements.
In some cases the entire result set may not fit into the array, so other
fields (the cursor fields) allow you to walk the results set in blocks
(like pages in a book). The cursor fields retrieve blocks of results
before or after the current page of results. When Pages are passed to
functions that accept arrays, only the array element of the Page is
examined or transformed. Other elements of the Page, such as the cursor,
remain unaffected and are passed directly through to the output.
Field |
Type |
Description |
|
|
The elements in the page.
|
|
|
The cursor for the next page, inclusive. Optional.
|
|
|
The cursor for the previous page, exclusive. Optional.
|
Functions that operate on pages:
All
|
Tests whether all of the provided values are true.
|
Any
|
Tests whether any of the provided values are true.
|
Append
|
Adds items to end of array.
|
Count
|
Counts the items in an array or set.
|
Difference
|
Returns an array of items in one array that are missing from additional
arrays.
|
Distinct
|
Returns an array of the distinct items within multiple arrays.
|
Drop
|
Removes items from start of array.
|
Filter
|
Fetches specific items from array.
|
Foreach
|
Iterates over array items.
|
Intersection
|
Returns an array of the items that exist in all arrays.
|
IsEmpty
|
Tests whether an array or set is empty.
|
IsNonEmpty
|
Tests whether an array or set contains items.
|
Map
|
Applies a function to all array items.
|
Max
|
Returns the largest value in a list of numbers.
|
Mean
|
Returns the average value of the items in an array or set.
|
Min
|
Returns the smallest value in a list of numbers.
|
Prepend
|
Adds items to start of array.
|
Reduce
|
Reduce an array or set to a result via a lambda function.
|
Reverse
|
Reverses the order of the items in an array.
|
Select
|
Retrieves a specific field value from a document.
|
SelectAll
|
Retrieves all values for a specific field from a document.
|
Sum
|
Sums the items in an array or set.
|
Take
|
Fetches items from start of array.
|
ToObject
|
Converts an array to an object.
|
Union
|
Returns an array that combines the items in multiple arrays.
|
|
|
The Query type denotes a query expression object.
|
|
The Ref type denotes a resource reference. Refs may be extracted from
documents, or constructed using the
Collection ,
Database ,
Function ,
Index , or
Role functions, or the general-purpose
Ref function.
client.Query(
Select("ref", Get(Collection("spells")))
);
result, err := client.Query(
f.Select("ref", f.Get(f.Collection("spells"))))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
System.out.println(
client.query(
Select(Value("ref"), Get(Collection("spells")))
).get());
client.query(
q.Select('ref', q.Get(q.Collection('spells')))
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
result = client.query(
q.select("ref", q.get(q.collection("spells")))
)
print(result)
println(Await.result(
client.query(
Select("ref", Get(Collection("spells")))
),
5.seconds
))
RefV(id = "spells", collection = RefV(id = "collections"))
{spells 0xc00008e300 0xc00008e300 <nil>}
ref(id = "spells", collection = ref(id = "collections"))
Ref(id=spells, collection=Ref(id=collections))
ref(id = "spells", collection = ref(id = "collections"))
client.Query(
Ref(Collection("spells"), "1")
);
System.out.println(
client.query(
Ref(Collection(Value("spells")), Value(1))
).get());
result, err := client.Query(
f.Ref(f.Collection("spells"), "1"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
println(Await.result(
client.query(
Ref(Collection("spells"), "1")
),
5.seconds
))
result = client.query(
q.ref(q.collection("spells"), "1")
)
print(result)
client.query(
q.Ref(q.Collection('spells'), '1')
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
RefV(id = "1", collection = RefV(id = "spells", collection = RefV(id = "collections")))
ref(id = "1", collection = ref(id = "spells", collection = ref(id = "collections")))
{1 0xc000164150 0xc000164150 <nil>}
ref(
id = "1",
collection = ref(
id = "spells",
collection = ref(
id = "collections"
)
)
)
Ref(id=1, collection=Ref(id=spells, collection=Ref(id=collections)))
Ref(Collection("spells"), "1")
|
|
The Set type denotes a set identifier. A set is a group of tuples,
typically representing resources or index terms , that are in a
specific order.
client.Query(
Match(Index("spells_by_element"), "fire")
);
System.out.println(
client.query(
Match(
Index(Value("spells_by_element")),
Value("fire")
)
).get());
result, err := client.Query(
f.MatchTerm(f.Index("spells_by_element"), "fire"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
client.query(Match(Index("spells_by_element"), "fire"))
result = client.query(
q.match(q.index("spells_by_element"), "fire")
)
print(result)
client.query(
q.Match(q.Index('spells_by_element'), 'fire')
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
SetRefV(System.Collections.Generic.Dictionary`2[System.String,FaunaDB.Types.Value])
{@set = {match: ref(id = "spells_by_element", collection = ref(id = "indexes")), terms: "fire"}}
{map[match:{spells_by_element 0xc0000bf290 0xc0000bf290 <nil>} terms:fire]}
{
@set = {
match: ref(
id = "spells_by_element",
collection = ref(id = "indexes")
),
terms: "fire"
}
}
SetRef({'match': Ref(id=spells_by_element, collection=Ref(id=indexes)), 'terms': 'fire'})
Match(Index("spells_by_element"), "fire")
Functions that operate on sets:
All
|
Tests whether all of the provided values are true.
|
Any
|
Tests whether any of the provided values are true.
|
Count
|
Counts the items in an array or set.
|
Difference
|
Returns the set of items in one set that are missing from additional
sets.
|
Distinct
|
Returns the set of distinct items within a set.
|
Events
|
Returns the set of events describing the history of a set or document.
|
Filter
|
Fetches specific items from a set.
|
Intersection
|
Returns the set of items that exist in all sets.
|
IsEmpty
|
Tests whether an array or set is empty.
|
IsNonEmpty
|
Tests whether an array or set contains items.
|
Join
|
Combines the items in a set with set’s indexed values.
|
Match
|
Returns the set of items that match search terms.
|
Max
|
Returns the largest value in a list of numbers.
|
Mean
|
Returns the average value of the items in an array or set.
|
Min
|
Returns the smallest value in a list of numbers.
|
Range
|
Returns a subset of a set, in the specified range.
|
Reduce
|
Reduce an array or set to a result via a lambda function.
|
Reverse
|
Reverses the order of the items in a set.
|
Singleton
|
Returns a set containing the first item of a set.
|
Sum
|
Sums the items in an array or set.
|
Union
|
Returns a set that combines the items in multiple sets.
|
|
|
The Timestamp type (usually written as ts ) stores an instant in time
expressed as a calendar date and time of day in UTC.
A Timestamp can safely store nanosecond precision, but be careful as
many operating system clocks provide only microsecond precision.
Timestamps may be inserted with offsets, but are converted to UTC; the
offset component is lost.
A Timestamp must be within the range -999999999-01-01T00:00:00Z -
9999-12-31T23:59:59.999999999Z .
A document’s ts field represents the most recent event that modified
the document.
client.Query(
Time("1970-01-01T00:00:00Z")
);
System.out.println(
client.query(
Time(Value("1970-01-01T00:00:00Z"))
).get());
result, err := client.Query(
f.Time("1970-01-01T00:00:00Z"))
if err != nil {
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(result)
}
client.query(Time("1970-01-01T00:00:00Z"))
result = client.query(
q.time("1970-01-01T00:00:00Z")
)
print(result)
client.query(
q.Time('1970-01-01T00:00:00Z')
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
FaunaTime(1970-01-01T00:00:00Z)
FaunaTime('1970-01-01T00:00:00Z')
Time("1970-01-01T00:00:00Z")
Functions that operate on times or dates:
Date
|
Converts an ISO-8601 string into a Date.
|
DayOfMonth
|
Returns the day of the month from a timestamp.
|
DayOfWeek
|
Returns the day of the week from a timestamp.
|
DayOfYear
|
Returns the day of the year from a timestamp.
|
Epoch
|
Creates a timestamp from an offset since 1970-01-01 in seconds,
milliseconds, microseconds, or nanoseconds.
|
Hour
|
Returns the hour from a timestamp.
|
Minute
|
Returns the minute from a timestamp.
|
Month
|
Returns the month from a timestamp.
|
Now
|
Returns a timestamp representing the current transaction time.
|
Second
|
Returns the second from a timestamp.
|
Time
|
Converts now , or an ISO-8601 string, into a timestamp.
|
TimeAdd
|
Adds an offset to a provided timestamp/date.
|
TimeDiff
|
Returns the difference between two timestamps/dates, in specified
units.
|
TimeSubtract
|
Subtracts an offset from a provided timestamp/date.
|
Year
|
Returns the year from a timestamp.
|
|