Other-functions

number:random() <Number>

Random returns a random Number between 0 and 1 inclusive.

Example

number:random($seed <Number>) <Number>

Random with $seed -argument returns a random Number between 0 and 1 inclusive. With the given seed value the return value is always the same.

Example

env:get($name) <String Or Empty>

env:get returns the value decided by $name -argument from the system's environment-variables. If value is not found then empty-value is returned.

Example

error:handled($handled) <JSON>

error:handled sets the error into handled state, which means that it won't be rethrown to upper-level error handlers. The input-value is passed unchanged.

Example

state:get($value)

state:get gets the value decided by $value -argument from the Operon's state.

The state is either in-memory map or Redis key-store. To use Redis, the Operon must be started with "redishost" -option given. If this is not given, Operon will default to in-memory state-map.

If value is not found from the state, then an empty-value is returned. Each Operon process has its own state-map. Redis-state is shared between all Operons, when the "redishost" and "redisprefix" match.

Example

state:get($value, $initialValue)

state:get gets the value decided by $value -argument from the Operon's state.

If value is not found from the state-map, then the value from the $initialValue-argument is set to state associated with the asked $value, and $initialValue is returned.

The state is either in-memory map or Redis key-store. To use Redis, the Operon must be started with "redishost" -option given. If this is not given, Operon will default to in-memory state-map.

If value is not found from the state, then an empty-value is returned. Each Operon process has its own state-map. Redis-state is shared between all Operons, when the "redishost" and "redisprefix" match.

Example

state:set($value)

state:set sets the value from $value-argument into Operon state. The value may be any Operon-type when using in-memory state. When using Redis-state, the value must be serializable into JSON or Raw-value.

The state is either in-memory map or Redis key-store. To use Redis, the Operon must be started with "redishost" -option given. If this is not given, Operon will default to in-memory state-map.

Example

Example

Example

stream:toRaw() <Raw>

stream:toRaw converts the Stream input-value into Raw-value. Some components may return Stream, and this function can be used to materialize it into Raw-value.

Example

path:create($path <String>) <Path>

path:create creates a new Path from the given String-typed $path-argument. Path can be created also by using the Path and giving the path as argument.

Example

Example

Example

path:linkRoot($value) <Path>

path:linkRoot links the value from $value-argument into path from the input-value.

Example

path:rootValue() <JSON>

path:rootValue returns the root-value that is linked with the input-path.

Example

path:value() <JSON>

path:value returns the value that is associated with the input-path.

NOTE: object dynamic deepscan returns paths, and the path value can be accessed with path:value -function.

Example

path:length() <Number>

path:length returns the number of parts that the path has. Path-part is either a key-based or position-based part.

Example

Example

path:subPath($length) <Path>

path:subPath returns a new Path that is deduced from the input-path. The new path contains the number of parts given in the $length-argument.

Example

path:parentPath() <Path>

path:parentPath returns the Path that is parent for the input-path.

Example

path:parts() <Array>

path:parts returns the input-path parts in an Array.

Example

function:name() <String>

function:name returns the name of the Function-reference that is the input-value.

Example

Example

function:fullName() <String>

function:fullName returns the full name of the Function-reference that is the input-value. Full name contains the namespace and the name of the function.

NOTE: if the function does not have a namespace, then the fullName has ":" prefix.

Example

Example

Example

function:namespace() <String>

function:namespace returns the namespace of Function-reference that is the input-value. If a function does not have a namespace, then an empty-String is returned.

Example

Example

Example

function:list() <Array>

function:list returns all the user-defined functions from the query and first-level imported modules.

Example

module:list() <Array>

module:list returns all the imported modules for the query.

Example

module:add($namespace) <String Or Error>

module:add dynamically adds a new module into Operon-runtime. If the module already exists, then an Error is thrown. The module must be given as a Raw-value in the input-value and must obey the Module-definition -rules, which means that it consists of Value- and Function-statements.

On success this function returns the namespace of the module as String.

On failure this function returns an Error with message telling the reason for failure (e.g. syntax error).

Example

Example

module:addOrUpdate($namespace) <String Or Error>

module:addOrUpdate dynamically adds a new module into Operon-runtime. If the module already exists, then this will replace the old module. The module must be given as a Raw-value in the input-value and must obey the Module-definition -rules, which means that it consists of Value- and Function-statements.

On success this function returns the namespace of the module as String.

On failure this function returns an Error with message telling the reason for failure (e.g. syntax error).

Example

Example

module:remove($namespace) <ANY>

module:remove removes the module from Operon-runtime given in the $namespace -argument. The input-value is bypassed unchanged.

Example