apoc.custom.declareProcedure
Procedure APOC Full
apoc.custom.declareProcedure(signature, statement, mode, description) - register a custom cypher procedure
Signature
apoc.custom.declareProcedure(signature :: STRING?, statement :: STRING?, mode = read :: STRING?, description = :: STRING?) :: VOID
Input parameters
Name | Type | Default |
---|---|---|
signature |
STRING? |
null |
statement |
STRING? |
null |
mode |
STRING? |
read |
description |
STRING? |
Usage Examples
We can create the function custom.powers
that returns a stream of the powers of the first parameter, up to and including the power provided by the second parameter:
CALL apoc.custom.declareProcedure(
'powers(input::INT, power::INT) :: (answer::INT)',
'UNWIND range(0, $power) AS power
RETURN $input ^ power AS answer'
);
Procedure, input and output names must have at least 2 characters. |
We can use this function, to return 4°, 4¹, 4², and 4³, as shown in the query below:
call custom.powers(4,3);
answer |
---|
1.0 |
4.0 |
16.0 |
64.0 |