FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

For more details, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions.

Call

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

Call( function, arguments, ... )
call( function, arguments, ... )
Call( function, arguments, ... )
Call( function, arguments, ... )
Call( function, arguments, ... )

Description

The Call function executes a user-defined function previously defined with the CreateFunction function.

The Call function takes a variable length list of arguments which must match the type and number of the function being called. These arguments are provided to the function being executed by Call.

Parameters

Parameter Type Definition and Requirements

function

String or Function Reference

The name, or Reference, of the function to call. A function reference can be acquired using the Function function.

arguments

Expressions

The arguments for the function.

Returns

The result returned by evaluation of the function with the given arguments.

Examples

The following example executes a user-defined function with the associated arguments:

client.query(
  q.Call('increment', 2)
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
3
result = client.query(
  q.call("increment", 2)
)
print(result)
3
result, err := client.Query(
	f.Call("increment", 2))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
3
try
{
    Value result = await client.Query(
        Call("increment", 2)
    );

    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
LongV(3)
Call('increment', 2)
3
Query metrics:
  •    bytesIn:  34

  •   bytesOut:  14

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 6ms

  •    retries:   0

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!