Executable ⇐ Entity

Kind: global class
Extends: Entity

new Executable(spec)

An executable function or script.

Param Type Description
spec Object An expanded {@linkcode Entity} specification:
spec.db Object A {@linkcode Database}.
spec.name String The name of the function or script.
spec.schema String The owning schema or file path of the function or script, respectively.
spec.sql String | QueryFile A function invocation statement or a pg-promise QueryFile.
spec.arity Number Number of parameters the executable expects, only for QueryFiles.
spec.isVariadic Boolean Whether the executable accepts variable-length argument lists as the last parameter, only for database functions.
spec.enhancedFunctions Boolean True to enable single row/value results processing.
spec.singleRow Boolean If true, return the first result row as an object (with enhancedFunctions).
spec.singleValue Boolean If true, return results as a primitive or primitives (with enhancedFunctions).

executable.invoke([options]) ⇒ Promise

Invoke the function or script.

Kind: instance method of Executable
Returns: Promise - Execution results as an array, unless options.single is toggled or enhanced functions are enabled and the function returns a single value.

Param Type Description
[options] Object Result processing options.