Equals
EqualsFn(value_1, value_2, ...)
Equals(value_1, value_2,...)
Equals(value_1, value_2, ...)
Equals(value_1, value_2, ...)
equals(value_1, value_2, ...)
Equals(value_1, value_2, ...)
Description
The Equals
function tests equivalence between a list of values.
Two functions are considered equal if their syntax is identical. For example:
|
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
Any |
A single value. |
|
Any |
A single value. |
|
Any |
Optional - Any number of additional values to compare for equality. |
Examples
The following query returns true
because fire
is equivalent to
fire
.
client.Query(EqualsFn("fire", "fire"));
true
curl https://db.fauna.com/ \
-u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
-d '{ "equals": [ "fire", "fire" ] }'
HTTP/1.1 200 OK
{ "resource": true }
result, err := client.Query(
f.Equals("fire", "fire"))
if (err != nil) {
fmt.Println(err)
} else {
fmt.Println(result)
}
true
System.out.println(client.query(Equals(Value("fire"),Value("fire"))).get());
true
client.query(q.Equals('fire', 'fire'))
.then((ret) => console.log(ret))
true
client.query(q.equals("fire", "fire"))
true
client.query(Equals("fire", "fire"))
true
The following query returns true
because null
values (and their
equivalents) are equal to themselves:
client.Query(EqualsFn(Null(), Null()));
true
curl https://db.fauna.com/ \
-u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
-d '{ "equals": [ null, null ] }'
HTTP/1.1 200 OK
{ "resource": true }
result, err := client.Query(
f.Equals(nil, f.Null()))
if (err != nil) {
fmt.Println(err)
} else {
fmt.Println(result)
}
true
System.out.println(client.query(Equals(Null(), Null())).get());
true
client.query(q.Equals(null, null))
.then((ret) => console.log(ret))
true
client.query(q.equals(None, None))
true
client.query(Equals(Null(), Null()))
true
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!