View Source Duct.Multi (duct v1.0.3)
Base on code of Ecto.Multi in here https://github.com/elixir-ecto/ecto/blob/b0e598926180e0788b4809dffd691bd0b5b54e81/lib/ecto/multi.ex
Link to this section Summary
Functions
Returns an empty Duct.Multi
struct.
Adds a function to run as part of the multi.
Returns the list of operations stored in multi
.
Link to this section Types
Link to this section Functions
@spec new() :: t()
Returns an empty Duct.Multi
struct.
example
Example
iex> Duct.Multi.new() |> Duct.Multi.to_list()
[]
Adds a function to run as part of the multi.
example
Example
Duct.Multi.new()
|> Duct.Multi.run("salary", fn _ -> 1_000_000 end)
|> Duct.Multi.run("tax", fn %{"salary" => salary} -> salary * 10 / 100 end)
|> Duct.run()
Returns the list of operations stored in multi
.
Always use this function when you need to access the operations you
have defined in Duct.Multi
. Inspecting the Duct.Multi
struct internals
directly is discouraged.