Call

Call( function, arguments, ... )
Call( function, arguments, ... )
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

Argument Type Definition and Requirements

function

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:

try
{
    Value result = await client.Query(
        Call("increment", 2)
    );

    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
LongV(3)
result, err := client.Query(
	f.Call("increment", 2))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
3
System.out.println(
    client.query(
        Call(Value("increment"), Value(2))
    ).get());
3
client.query(
  q.Call('increment', 2)
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
3
result = client.query(
  q.call("increment", 2)
)
print(result)
3
try {
  println(Await.result(
    client.query(
        Call("increment", 2)
    ),
    5.seconds
))} catch {
  case unknown: Throwable => println("Error: " + unknown.getMessage())
}
3
Call('increment', 2)
3

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's Discourse forums or email docs@fauna.com

Thank you for your feedback!