View Source Flint.Schema (Flint v0.4.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 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.

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

Link to this macro

embedded_schema(list)

View Source (macro)

Wraps Ecto's embedded_schema macro, injecting Flint's custom macro implementation into the module space.

Link to this macro

embeds_many(name, schema, opts \\ [])

View Source (macro)

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
Link to this macro

embeds_many(name, schema, opts, list)

View Source (macro)
Link to this macro

embeds_many!(name, schema, opts \\ [])

View Source (macro)

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
Link to this macro

embeds_many!(name, schema, opts, list)

View Source (macro)
Link to this macro

embeds_one(name, schema, opts \\ [])

View Source (macro)

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
Link to this macro

embeds_one(name, schema, opts, list)

View Source (macro)
Link to this macro

embeds_one!(name, schema, opts \\ [])

View Source (macro)

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
Link to this macro

embeds_one!(name, schema, opts, list)

View Source (macro)
Link to this macro

field(name, type \\ :string, opts \\ [])

View Source (macro)

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.

Link to this macro

field(name, type, opts, list)

View Source (macro)
Link to this macro

field!(name, type \\ :string, opts \\ [])

View Source (macro)

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).

Link to this macro

field!(name, type, opts, list)

View Source (macro)
Link to this function

new(module, params \\ %{}, bindings \\ [])

View Source

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.

Link to this function

new!(module, params \\ %{}, bindings \\ [])

View Source

Same as new, except will raise if any errors exist in the changeset.