QuickFactory behaviour (quick_factory v0.1.0)
View SourceSummary
Callbacks
Callback that returns a map with valid defaults for the schema.
Callback that returns a struct with valid defaults for the schema.
Callback that returns which changeset function to use.
Callback that returns the schema's repo module.
Callback that returns the schema module.
Functions
Builds a schema given the factory module
and an optional
list/map of params
.
Builds many parameters for a schema changeset/2
function given the factory
module
and an optional list/map of params
.
Builds the parameters for a schema changeset/2
function given the factory
module
and an optional list/map of params
.
Removes all the instances of a schema from the database given its factory
module
.
Inserts a schema given the factory module
and an optional list/map of
params
. Fails on error.
Insert as many as count
schemas given the factory module
and an optional
list/map of params
.
Types
Callbacks
Callback that returns a map with valid defaults for the schema.
Callback that returns a struct with valid defaults for the schema.
@callback changeset() :: atom()
Callback that returns which changeset function to use.
@callback repo() :: module()
Callback that returns the schema's repo module.
@callback schema() :: module()
Callback that returns the schema module.
Functions
Builds a schema given the factory module
and an optional
list/map of params
.
@spec build_many_params(pos_integer(), module(), keyword() | map(), build_opts()) :: [ map() ]
Builds many parameters for a schema changeset/2
function given the factory
module
and an optional list/map of params
.
@spec build_params(module(), keyword() | map(), build_opts()) :: map()
Builds the parameters for a schema changeset/2
function given the factory
module
and an optional list/map of params
.
Removes all the instances of a schema from the database given its factory
module
.
Inserts a schema given the factory module
and an optional list/map of
params
. Fails on error.
Insert as many as count
schemas given the factory module
and an optional
list/map of params
.