Hafnium (hafnium v0.2.1) View Source

## Example

iex> defmodule Demo do
...>   use Hafnium
...> end
...> 
...> Demo.name
...> ## -> :hafnium_test_demo
...> 

Link to this section Summary

Types

  • :ok — success
  • :error — error
  • :noop — like ok but do nothing
  • :fatal — error and break
t()

Base struct

Link to this section Types

Specs

input() :: any()

Specs

invoke_result() :: t() | any()

Specs

pipe_result() :: t() | pipe_atom_result() | pipe_tuple_result()

Specs

result() :: {state(), any()}

Specs

state() :: :noop | :error | :ok | :fatal
  • :ok — success
  • :error — error
  • :noop — like ok but do nothing
  • :fatal — error and break

Specs

t() :: %Hafnium{
  __module__: current_module :: module(),
  __pipeline__: Hafnium.Pipeline.t(),
  context: context :: keyword(),
  input: input(),
  pipelines: pipelines :: [Hafnium.Pipeline.t()],
  result: result :: result()
}

Base struct

Link to this section Functions

Specs

invoke(t(), %{}) :: t()

Specs

new(atom()) :: %Hafnium{
  __module__: term(),
  __pipeline__: term(),
  context: term(),
  input: term(),
  pipelines: term(),
  result: term()
}
Link to this macro

pipeline(module)

View Source (macro)

Add pipeline

defmodule ExampleApi do
  use Elixir.Hafnium

  pipeline MyPipeline1, [foo: :bar]
  pipeline MyPipeline2
end
Link to this macro

pipeline(module, opts)

View Source (macro)