View Source Flint.Schema (Flint v0.6.0)
Flint.Schema provides custom implementations of certain Ecto embedded_schema DSL keywords.
When you use Flint, all of these definitions are imported into the module and override the default
Ecto.Schema implementations. You should not have to directly interact with this module.
Summary
Functions
Dumps the JSON representation of the given schema
Wraps Ecto's embeds_many macro to accept additional options which are consumed by Flint.Changeset.
Marks an embeds_many field as required by storing metadata in a module attribute, then calls Flint.Schema.embeds_many.
Wraps Ecto's embeds_one macro to accept additional options which are consumed by Flint.Changeset.
Marks an embeds_one field as required by storing metadata in a module attribute, then calls Flint.Schema.embeds_one.
Wraps Ecto's field macro to accept additional options which are consumed by Flint.Changeset.
Marks a field as required by storing metadata in a module attribute, then calls Flint.Schema.field.
Creates a new schema struct according to the schema's changeset implementation, immediately applying
the changes from the changeset regardless of errors.
Same as new, except will raise if any errors exist in the changeset.
Functions
Dumps the JSON representation of the given schema
Wraps Ecto's embedded_schema macro, injecting Flint's custom macro implementation into the module space.
Wraps Ecto's embeds_many macro to accept additional options which are consumed by Flint.Changeset.
Flint options that are passed to embeds_many are stripped by Flint before passing them to Ecto.Schema.embeds_many and
stored in module attributed for the schema's module.
The following default options are passed to Flint.Schema.embeds_many and can be overriden at the Application level or at the
local call level.
Default Options
on_replace: :delete
Marks an embeds_many field as required by storing metadata in a module attribute, then calls Flint.Schema.embeds_many.
The metadata tracking is not enforced at the schema / struct level (eg. through enforced keys), but rather
at the schema validation level (through something such as Flint.Changeset.changeset).
The following default options are passed to Flint.Schema.embeds_many! and can be overriden at the Application level or at the
local call level.
Default Options
on_replace: :delete
Wraps Ecto's embeds_one macro to accept additional options which are consumed by Flint.Changeset.
Flint options that are passed to embeds_one are stripped by Flint before passing them to Ecto.Schema.embeds_one and
stored in module attributed for the schema's module.
The following default options are passed to Flint.Schema.embeds_one and can be overriden at the Application level or at the
local call level.
Default Options
defaults_to_struct: true,
on_replace: :delete
Marks an embeds_one field as required by storing metadata in a module attribute, then calls Flint.Schema.embeds_one.
The metadata tracking is not enforced at the schema / struct level (eg. through enforced keys), but rather
at the schema validation level (through something such as Flint.Changeset.changeset).
The following default options are passed to Flint.Schema.embeds_one! and can be overriden at the Application level or at the
local call level.
Default Options
on_replace: :delete
Wraps Ecto's field macro to accept additional options which are consumed by Flint.Changeset.
Flint options that are passed to field are stripped by Flint before passing them to Ecto.Schema.field and
stored in module attributed for the schema's module.
If no Flint-specific options or features are used, this acts the same as Ecto.Schema.field.
Marks a field as required by storing metadata in a module attribute, then calls Flint.Schema.field.
The metadata tracking is not enforced at the schema / struct level (eg. through enforced keys), but rather
at the schema validation level (through something such as Flint.Changeset.changeset).
Creates a new schema struct according to the schema's changeset implementation, immediately applying
the changes from the changeset regardless of errors.
If you want to manually handle error cases, you should use the changeset function itself.
Same as new, except will raise if any errors exist in the changeset.