IsEmpty

IsEmpty( arrayOrSet )
IsEmpty( arrayOrSet )
IsEmpty( arrayOrSet )
IsEmpty( arrayOrSet )
is_empty( array_or_set )
is_empty( array_or_set )
IsEmpty( arrayOrSet )
IsEmpty( arrayOrSet )

Description

The IsEmpty function returns true only if there are no items in arrayOrSet.

Parameters

Argument Type Definition and Requirements

arrayOrSet

Array, Page, or Set

An array, page, or set, which is checked for the non-existence of items.

Returns

Returns a boolean.

Examples

The query below executes an array of independent IsEmpty operations and returns the results in an array. The result array position matches the execution array position. The first IsEmpty operation operates on an empty array and places the result of true in the top position in the result array. The second IsEmpty operation operates on an array with a single value of 1 and places the result of false in the second position in the result array. The third IsEmpty operation operates on an array with a two values and places the result of false in the third position in the result array.

client.Query(
  Arr(
    IsEmpty(Arr()),
    IsEmpty(Arr(Value(1))),
    IsEmpty(Arr(Value(1), Value(2), Value(3)))
  )
)
System.out.println(
  client.query(
    Arr(
      IsEmpty(Arr()),
      IsEmpty(Arr(Value(1))),
      IsEmpty(Arr(Value(1), Value(2), Value(3)))
    )
  ).get());
result, err := client.Query(
  f.Arr{
    f.IsEmpty(f.Arr{}),
    f.IsEmpty(f.Arr{1}),
    f.IsEmpty(f.Arr{1, 2, 3})})

if (err != nil) {
  fmt.Println(err)
} else {
  fmt.Println(result)
}
System.out.println(
  client.query(
    Arr(
      IsEmpty(Arr()),
      IsEmpty(Arr(Value(1))),
      IsEmpty(Arr(Value(1), Value(2), Value(3)))
    )
  ).get());
client.query([
  q.IsEmpty([]),
  q.IsEmpty([1]),
  q.IsEmpty([1, 2, 3]),
])
.then((ret) => console.log(ret))
.catch((err) => console.log(err))
result = client.query([
  q.is_empty([]),
  q.is_empty([1]),
  q.is_empty([1, 2, 3]),
])
print(result)
puts $client.query {[
  is_empty([]),
  is_empty([1]),
  is_empty([1, 2, 3]),
]}
println(Await.result(
  client.query(Arr(
    IsEmpty(Arr()),
    IsEmpty(Arr(1)),
    IsEmpty(Arr(1, 2, 3))
  )),
  5.seconds
))
client.query(
  Arr(
    IsEmpty(Arr()),
    IsEmpty(Arr(Value(1))),
    IsEmpty(Arr(Value(1), Value(2), Value(3)))
  )
)
[true, false, false]
[true, false, false]
[true false false]
[true, false, false]
[ true, false, false ]
[True, False, False]
true
false
false
[true, false, false]
[true, false, false]

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!