A tiny pipeline library that helps untangle a series of steps, where each step possibly depends on the output of previous steps, and each result should be checked for errors before continuing.
Pipeline functions can signal an error by returning the result of calling
failure
. There is no need to wrap successful values.
A tiny pipeline library that helps untangle a series of steps, where each step possibly depends on the output of previous steps, and each result should be checked for errors before continuing. Pipeline functions can signal an error by returning the result of calling `failure`. There is no need to wrap successful values.
(failure message & [data props])
Construct a pipeline function failure. Pass in a string message, and optional
data
, which will be available under :funlines.core/error-data
. Even more
optionally, pass in a map of props
that will be merged onto the resulting
map.
Construct a pipeline function failure. Pass in a string message, and optional `data`, which will be available under `:funlines.core/error-data`. Even more optionally, pass in a map of `props` that will be merged onto the resulting map.
(ok? res)
Given the result of a pipeline function, or indeed a full pipeline run, check for success.
Given the result of a pipeline function, or indeed a full pipeline run, check for success.
(run steps & [ctx])
Run a pipeline, passing in an optional initial context. A pipeline is a
sequence of steps, each step a pair of [keyword function]. The function will
be called with a single argument, a context
map. The function's return value
will be assoc-ed to the context map under the keyword from the tuple. The new
context will be passed to the next pair.
Returns either the first failing step in a map of
{:funlines.core/ok? false, :funlines.core/step step-kw}
and possibly more
information about the error (see funlines.core/failure
) or the resulting
context map after all steps have succeeded.
Run a pipeline, passing in an optional initial context. A pipeline is a sequence of steps, each step a pair of [keyword function]. The function will be called with a single argument, a `context` map. The function's return value will be assoc-ed to the context map under the keyword from the tuple. The new context will be passed to the next pair. Returns either the first failing step in a map of `{:funlines.core/ok? false, :funlines.core/step step-kw}` and possibly more information about the error (see `funlines.core/failure`) or the resulting context map after all steps have succeeded.
(run-some step-fns & [ctx])
Runs step functions until a successful result is obtained, then returns it.
step-fns
is a sequence of functions. Optionally pass in a ctx
that will be
passed to the functions. If no steps are successful then the failure result
from the final step is returned.
Runs step functions until a successful result is obtained, then returns it. `step-fns` is a sequence of functions. Optionally pass in a `ctx` that will be passed to the functions. If no steps are successful then the failure result from the final step is returned.
(run-step f ctx)
Run a single step, representing exceptions as pipeline failures.
Run a single step, representing exceptions as pipeline failures.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close