apoc.custom.declareFunction

Procedure APOC Full

apoc.custom.declareFunction(signature, statement, forceSingle, description) - register a custom cypher function

Signature

apoc.custom.declareFunction(signature :: STRING?, statement :: STRING?, forceSingle = false :: BOOLEAN?, description =  :: STRING?) :: VOID

Input parameters

Name Type Default

signature

STRING?

null

statement

STRING?

null

forceSingle

BOOLEAN?

false

description

STRING?

Usage Examples

We can create the function custom.double, that doubles the provided value, by running the following function:

CALL apoc.custom.declareFunction(
  'double(input::INT) :: INT',
  'RETURN $input*2 as answer'
);

We can use this function, as shown in the query below:

RETURN custom.double(83) AS value;
Table 1. Results
value

166

If we don’t need fine grained control over our function’s signature, see apoc.custom.asFunction.