Expression.V2.Callbacks (expression v2.41.4)
Use this module to implement one's own callbacks.
The standard callbacks available are implemented in Expression.V2.Callbacks.Standard
.
defmodule MyCallbacks do
use Expression.V2.Callbacks
@doc """
Roll a dice and randomly return a number between 1 and 6.
"""
def dice_roll(ctx) do
Enum.random(1..6)
end
end
Summary
Functions
Convert a string function name into an atom meant to handle that function
Callback a function while evaluating the context against an expression.
Functions
Convert a string function name into an atom meant to handle that function
Reserved words such as and
, if
, and or
are automatically suffixed
with an _
underscore.
@spec callback( module :: module(), context :: map(), function_name :: binary(), arguments :: [any()] ) :: any()
Callback a function while evaluating the context against an expression.
Callback functions in this module are either:
- The function name as is
- The function name with an underscore suffix if the function name is a reserved word
- The function name suffixed with
_vargs
if the takes a variable set of arguments