Query

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Copied!
Query( lambda )

Description

The Query function wraps the provided Lambda function, preventing immediate execution, and making the function available for use in index bindings, CreateFunction, and ABAC predicates.

For example, when creating a named function with CreateFunction, Query defers execution of the Lambda function until the Call function is called.

While you can use a Query in a Let binding, it is not possible to call the bound function. You also cannot use a Query instead of a lambda function, such as with Map or Reduce.

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

shellCopied!
Equals(Query(Lambda('a', 5)), Query(Lambda('a', 5)))
true

Parameters

Parameter 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!
Query(Lambda('X', Var('X')))
Query(Lambda("X", Var("X")))
Query metrics:
  •    bytesIn:  43

  •   bytesOut:  75

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 3ms

  •    retries:   0

\