View Source Smokestack.ParamBuilder (smokestack v0.9.1)
Handles the building of parameters.
Summary
Types
Encode the result using the specified encoder.
Format the keys in the specified case. Defaults to :snake
Convert the keys into the specified type. Defaults to :atom
.
Nest the result within the specified key in the output.
Functions
Run the factory and return a map or list-of-maps of params.
Types
@type encode_option() :: {:encode, module()}
Encode the result using the specified encoder.
Smokestack will call encode/1
on the module provided with the generated
result (or results). For example set encode: Jason
or encode: Poison
to encode the results as a JSON string.
The module's encode function should return an ok/error tuple.
@type error() :: any() | Smokestack.ManyBuilder.error() | Smokestack.RelatedBuilder.error()
@type key_case_option() :: {:key_case, :camel | :constant | :dot | :header | :kebab | :name | :pascal | :path | {:path, separator :: String.t()} | :sentence | :snake | :title}
Format the keys in the specified case. Defaults to :snake
@type key_type_option() :: {:key_type, :string | :atom}
Convert the keys into the specified type. Defaults to :atom
.
Nest the result within the specified key in the output.
@type option() :: encode_option() | key_case_option() | key_type_option() | nest_option() | Smokestack.ManyBuilder.option() | Smokestack.RelatedBuilder.option()
Functions
@spec build(Smokestack.Dsl.Factory.t(), [option()]) :: {:ok, result()} | {:error, error()}
Run the factory and return a map or list-of-maps of params.