Call

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

Parameter 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] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
3
result = client.query(
  q.call("increment", 2)
)
print(result)
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!