View Source Spark.Dsl.Builder (spark v2.1.20)

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

Summary

Functions

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

Types

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

Functions

Link to this macro

defbuilder(arg, list)

View Source (macro)
Link to this macro

defbuilderp(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.