2024-03-14 17:13:04 +13:00
<!--
This file was generated by Spark. Do not edit it by hand.
-->
2023-09-20 12:22:06 +12:00
# DSL: Smokestack.Dsl
The DSL definition for the Smokestack DSL.
<!-- - ash - hq - hide - start --> <!-- - -->
## DSL Documentation
### Index
* smokestack
* factory
2024-05-26 20:50:33 +12:00
* after_build
2023-09-20 12:22:06 +12:00
* attribute
2024-05-26 20:50:33 +12:00
* before_build
2023-09-20 12:22:06 +12:00
### Docs
## smokestack
* [factory ](#module-factory )
2024-05-26 20:50:33 +12:00
* after_build
2023-09-20 12:22:06 +12:00
* attribute
2024-05-26 20:50:33 +12:00
* before_build
2023-09-20 12:22:06 +12:00
---
2024-03-28 10:04:54 +13:00
* `:domain` (module that adopts `Ash.Domain` ) - The default Ash Domain to use when evaluating loads
2023-09-20 12:22:06 +12:00
### factory
Define factories for a resource
2024-05-26 20:50:33 +12:00
* after_build
2023-09-20 12:22:06 +12:00
* attribute
2024-05-26 20:50:33 +12:00
* before_build
2023-09-20 12:22:06 +12:00
2024-03-28 10:04:54 +13:00
* `:domain` (module that adopts `Ash.Domain` ) - The Ash Domain to use when evaluating loads
2023-09-20 12:22:06 +12:00
2024-03-28 10:04:54 +13:00
* `:resource` (module that adopts `Ash.Resource` ) - Required. An Ash Resource
2023-09-20 12:22:06 +12:00
* `:variant` (`t:atom/0`) - The name of a factory variant The default value is `:default` .
2024-05-29 09:50:43 +12:00
* `:auto_build` (one or a list of `t:atom/0` ) - A list of relationships that should always be built when building this factory The default value is `[]` .
* `:auto_load` - An Ash "load statement" to always apply when building this factory The default value is `[]` .
2023-09-20 12:22:06 +12:00
2024-05-26 20:50:33 +12:00
##### after_build
Modify the record after building.
Allows you to provide a function which can modify the built record before returning.
These hooks are only applied when building records and not parameters.
* `:hook` (mfa or function of arity 1) - Required. A function which returns an updated record
2023-09-20 12:22:06 +12:00
##### attribute
* `:name` (`t:atom/0`) - Required. The name of the target attribute
* `:generator` - Required. A function which can generate an appropriate value for the attribute.œ
2024-05-26 20:50:33 +12:00
##### before_build
Modify the attributes before building.
Allows you to provide a function which can modify the the attributes before building.
* `:hook` (mfa or function of arity 1) - Required. A function which returns an updated record
2023-09-20 12:22:06 +12:00
<!-- - ash - hq - hide - stop --> <!-- - -->
## smokestack
### Nested DSLs
* [factory ](#smokestack-factory )
2024-05-26 20:50:33 +12:00
* after_build
2023-09-20 12:22:06 +12:00
* attribute
2024-05-26 20:50:33 +12:00
* before_build
2023-09-20 12:22:06 +12:00
### Options
2024-03-14 17:13:04 +13:00
2023-09-20 12:22:06 +12:00
| Name | Type | Default | Docs |
2024-03-14 17:13:04 +13:00
|------|------|---------|------|
2024-03-28 10:04:54 +13:00
| [`domain` ](#smokestack-domain ){: #smokestack -domain } | `module` | | The default Ash Domain to use when evaluating loads |
2023-09-20 12:22:06 +12:00
## smokestack.factory
```elixir
2024-03-14 17:13:04 +13:00
factory resource, variant \\ :default
2023-09-20 12:22:06 +12:00
```
Define factories for a resource
### Nested DSLs
2024-05-26 20:50:33 +12:00
* [after_build ](#smokestack-factory-after_build )
2023-09-20 12:22:06 +12:00
* [attribute ](#smokestack-factory-attribute )
2024-05-26 20:50:33 +12:00
* [before_build ](#smokestack-factory-before_build )
2023-09-20 12:22:06 +12:00
### Arguments
2024-03-14 17:13:04 +13:00
2023-09-20 12:22:06 +12:00
| Name | Type | Default | Docs |
2024-03-14 17:13:04 +13:00
|------|------|---------|------|
| [`resource` ](#smokestack-factory-resource ){: #smokestack -factory-resource .spark-required} | `module` | | An Ash Resource |
| [`variant` ](#smokestack-factory-variant ){: #smokestack -factory-variant } | `atom` | `:default` | The name of a factory variant |
2023-09-20 12:22:06 +12:00
### Options
2024-03-14 17:13:04 +13:00
2023-09-20 12:22:06 +12:00
| Name | Type | Default | Docs |
2024-03-14 17:13:04 +13:00
|------|------|---------|------|
2024-03-28 10:04:54 +13:00
| [`domain` ](#smokestack-factory-domain ){: #smokestack -factory-domain } | `module` | | The Ash Domain to use when evaluating loads |
2024-05-29 09:50:43 +12:00
| [`auto_build` ](#smokestack-factory-auto_build ){: #smokestack -factory-auto_build } | `atom \| list(atom)` | `[]` | A list of relationships that should always be built when building this factory |
| [`auto_load` ](#smokestack-factory-auto_load ){: #smokestack -factory-auto_load } | `atom \| keyword \| list(atom \| keyword)` | `[]` | An Ash "load statement" to always apply when building this factory |
2023-09-20 12:22:06 +12:00
2024-05-26 20:50:33 +12:00
## smokestack.factory.after_build
```elixir
after_build hook
```
Modify the record after building.
Allows you to provide a function which can modify the built record before returning.
These hooks are only applied when building records and not parameters.
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`hook` ](#smokestack-factory-after_build-hook ){: #smokestack -factory-after_build-hook .spark-required} | `(any -> any) \| mfa` | | A function which returns an updated record |
### Introspection
Target: `Smokestack.Dsl.AfterBuild`
2023-09-20 12:22:06 +12:00
## smokestack.factory.attribute
```elixir
attribute name, generator
```
### Arguments
2024-03-14 17:13:04 +13:00
2023-09-20 12:22:06 +12:00
| Name | Type | Default | Docs |
2024-03-14 17:13:04 +13:00
|------|------|---------|------|
| [`name` ](#smokestack-factory-attribute-name ){: #smokestack -factory-attribute-name .spark-required} | `atom` | | The name of the target attribute |
2024-03-28 10:04:54 +13:00
| [`generator` ](#smokestack-factory-attribute-generator ){: #smokestack -factory-attribute-generator .spark-required} | `(-> any) \| mfa \| (any -> any) \| mfa \| (any, any -> any) \| mfa \| Smokestack.Template.Choose \| Smokestack.Template.Constant \| Smokestack.Template.Cycle \| Smokestack.Template.NTimes \| Smokestack.Template.Sequence` | | A function which can generate an appropriate value for the attribute.œ |
2023-09-20 12:22:06 +12:00
### Introspection
Target: `Smokestack.Dsl.Attribute`
2024-05-26 20:50:33 +12:00
## smokestack.factory.before_build
```elixir
before_build hook
```
Modify the attributes before building.
Allows you to provide a function which can modify the the attributes before building.
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`hook` ](#smokestack-factory-before_build-hook ){: #smokestack -factory-before_build-hook .spark-required} | `(any -> any) \| mfa` | | A function which returns an updated record |
### Introspection
Target: `Smokestack.Dsl.BeforeBuild`
2023-09-20 12:22:06 +12:00
### Introspection
Target: `Smokestack.Dsl.Factory`
2024-03-14 17:13:04 +13:00
< style type = "text/css" > . spark-required :: after { content : "*" ; color : red !important ; } < / style >