mirror of https://gitee.com/bigwinds/arangodb
45 lines
1.7 KiB
Plaintext
45 lines
1.7 KiB
Plaintext
!CHAPTER Conventions
|
|
|
|
The *::* symbol is used inside AQL as the namespace separator. Using
|
|
the namespace separator, users can create a multi-level hierarchy of
|
|
function groups if required.
|
|
|
|
Examples:
|
|
|
|
``` js
|
|
RETURN myfunctions::myfunc()
|
|
|
|
RETURN myfunctions::math::random()
|
|
```
|
|
|
|
**Note**: As all function names in AQL, user function names are also
|
|
case-insensitive.
|
|
|
|
Built-in AQL functions reside in the namespace *_aql*, which is also
|
|
the default namespace to look in if an unqualified function name is
|
|
found. Adding user functions to the *_aql* namespace is disallowed and
|
|
will fail.
|
|
|
|
User functions can take any number of input arguments and should
|
|
provide one result. They should be kept purely functional and thus free of
|
|
side effects and state.
|
|
|
|
Modification of global variables is unsupported, as is changing
|
|
the data of a collection from inside an AQL user function.
|
|
|
|
User function code is late-bound, and may thus not rely on any variables
|
|
that existed at the time of declaration. If user function code requires
|
|
access to any external data, it must take care to set up the data by
|
|
itself.
|
|
|
|
User functions must only return primitive types (i.e. *null*, boolean
|
|
values, numeric values, string values) or aggregate types (lists or
|
|
documents) composed of these types.
|
|
Returning any other Javascript object type from a user function may lead
|
|
to undefined behavior and should be avoided.
|
|
|
|
Internally, user functions are stored in a system collection named
|
|
*_aqlfunctions*. That means that by default they are excluded from dumps
|
|
created with [arangodump](../Arangodump/README.md). To include AQL user functions in a dump, the
|
|
dump should be started with the option *--include-system-collections true*.
|