Query

Copied!
( lambda )

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).

Two functions are considered equal if their syntax is identical. For example:

shellCopied!
((('a', 5)), (('a', 5)))
true

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:

Copied!
client.query(
  q.(q.('X', q.('X')))
)
.then((ret) => console.log(ret))
(("X", ("X")))

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!