View Source Spark.Dsl.Builder (spark v1.0.6)

Utilities for building DSL objects programatically, generally used in transformers.

Link to this section Summary

Functions

Handles nested values that may be {:ok, result} or {:error, term}, returning any errors and unwrapping any ok values

Link to this section Types

@type input() :: {:ok, Spark.Dsl.t()} | {:error, term()} | Spark.Dsl.t()
@type result() :: {:ok, Spark.Dsl.t()} | {:error, term()}

Link to this section Functions

Link to this macro

defbuilder(arg, list)

View Source (macro)
Link to this function

handle_nested_builders(opts, nested)

View Source

Handles nested values that may be {:ok, result} or {:error, term}, returning any errors and unwrapping any ok values

This allows users of builders to do things like:

dsl_state
|> Ash.Resource.Builder.add_new_action(:update, :publish,
  changes: [
    Ash.Resource.Builder.build_action_change(
      Ash.Resource.Change.Builtins.set_attribute(:state, :published)
    )
  ]
)

If your builder function calls handle_nested_builders/2 with their input before building the thing its building.