agala v2.0.0 Agala.Chain.Builder
Link to this section Summary
Functions
A macro that stores a new chain. opts
will be passed unchanged to the new
chain
Compiles a chain pipeline
Link to this section Types
Link to this section Functions
A macro that stores a new chain. opts
will be passed unchanged to the new
chain.
This macro doesn’t add any guards when adding the new chain to the pipeline;
for more information about adding chains with guards see compile/1
.
Examples
chain Agala.Chain.Logger # chain module
chain :foo, some_options: true # chain function
Link to this function
compile(env, pipeline, builder_opts)
compile(Macro.Env.t, [{chain, Agala.Chain.opts, Macro.t}], Keyword.t) :: {Macro.t, Macro.t}
Compiles a chain pipeline.
Each element of the chain pipeline (according to the type signature of this function) has the form:
{chain_name, options, guards}
Note that this function expects a reversed pipeline (with the last chain that has to be called coming first in the pipeline).
The function returns a tuple with the first element being a quoted reference to the connection and the second element being the compiled quoted pipeline.
Examples
Agala.Chain.Builder.compile(env, [
{Agala.Chain.Logger, [], true}, # no guards, as added by the Agala.Chain.Builder.chain/2 macro
{Agala.Chain.Head, [], quote(do: a when is_binary(a))}
], [])