Function.byName()
Learn: User-defined functions (UDFs) |
---|
Get a user-defined Function document by its name.
Description
The Function.byName()
method gets the Function object if it exists and
is accessible.
Return value
One of:
Type | Description |
---|---|
FunctionDef |
Function object. See Function document definition. |
NullFunctionDef |
UDF document doesn’t exist or is inaccessible. |
Examples
-
Fetch a UDF when it exists and is accessible:
Function.byName("inventory")
{ name: "inventory", coll: Function, ts: Time("2099-04-10T17:50:39.955Z"), body: <<-END (name) => { Product.byName(name) { name: .name, description: .description, stock: .stock } } END, role: "server" }
-
When the UDF document doesn’t exist or is inaccessible:
Function.byName("doesnotexist")
Function.byName("doesnotexist") /* not found */
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!