Query

Query( lambda )
Query( lambda )
Query( lambda )
Query( lambda )
query( lambda )
Query( lambda )
Not available in this language yet.
Not available in this language yet.

Description

The Query function wraps the provided Lambda function, preventing immediate execution, and making the function available sometime later.

For example, when creating a named function with CreateFunction, Query defers execution of the Lambda function until the Call function is called. Query is also used when defining predicate functions for Attribute-based access control (ABAC).

Parameters

Argument Type Definition and Requirements

lambda

A Lambda function.

The Lambda function to wrap.

Returns

The wrapped query.

Examples

The following query returns the provided Lambda function wrapped in the Query wrapper:

Value result = await client.Query(
  Query(Lambda("X", Var("X")))
);

IResult<Value> data = result.To<Value>();
data.Match(
  Success: value => Console.WriteLine($"{value}"),
  Failure: error => Console.WriteLine($"Query failed:\n{error}")
);
result, err := client.Query(
  f.Query(f.Lambda("X", f.Var("X"))))

if (err != nil) {
  fmt.Println(err)
} else {
  fmt.Println(result)
}
System.out.println(
    client.query(
        Query(Lambda("X", Var("X")))
    ).get());
client.query(
  q.Query(q.Lambda('X', q.Var('X')))
)
.then((ret) => console.log(ret))
print(client.query(
  q.query(q.lambda_("X", q.var("X")))
))
println(Await.result(
  client.query(
    Query(Lambda("X", Var("X")))
  ),
  5.seconds
))
Not available in this language yet.
Not available in this language yet.
QueryV(System.Collections.Generic.Dictionary`2[System.String,FaunaDB.Query.Expr])
{[123 34 108 97 109 98 100 97 34 58 34 88 34 44 34 101 120 112 114 34 58 123 34 118 97 114 34 58 34 88 34 125 125]}
QueryV({lambda=X, expr={var=X}})
Query(Lambda("X", Var("X")))
{lambda: "X", expr: {var: "X"}}
Query({'lambda': 'X', 'expr': {'var': 'X'}})

Was this article helpful?

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

Thank you for your feedback!