CreateFunction
CreateFunction( param_object )
Description
The CreateFunction
operation adds a new user-defined function with the
specified parameters.
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Object |
The |
param_object
Field Name | Field Type | Definition and Requirements | ||
---|---|---|---|---|
|
The name of the function. Cannot be |
|||
|
The Fauna Query Language instructions to be executed. |
|||
|
Optional - This is user-defined metadata for the user-defined function. It is provided for the developer to store information at the function level. |
|||
|
Optional - Specifies the role that should be used when the user-defined function is called, which would typically be used to provide privilege escalation when current privileges would otherwise be too restrictive. To use a built-in role, specify one of the strings
|
Returns
An object containing the metadata of CreateFunction
operations.
Field Name | Field Type | Definition and Requirements |
---|---|---|
|
The reference is an automatically-generated, unique identifier within the database to identify the function that was created. |
|
|
The logical name of the function created. |
|
|
The role that should be used when the function is called. Only included
when |
|
|
The timestamp, with microsecond resolution, associated with the creation of the function. |
|
|
The Fauna Query Language instructions to be executed. |
Examples
The following query creates a user-defined function called "double":
{
ref: Function("double"),
ts: 1631916677410000,
name: 'double',
body: Query(Lambda("x", Add(Var("x"), Var("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!