View Source Ecto.Schema.Metadata (Ecto v3.10.0)

Stores metadata of a struct.

state

State

The state of the schema is stored in the :state field and allows following values:

  • :built - the struct was constructed in memory and is not persisted to database yet;
  • :loaded - the struct was loaded from database and represents persisted data;
  • :deleted - the struct was deleted and no longer represents persisted data.

source

Source

The :source tracks the (table or collection) where the struct is or should be persisted to.

prefix

Prefix

Tracks the source prefix in the data storage.

context

Context

The :context field represents additional state some databases require for proper updates of data. It is not used by the built-in adapters of Ecto.Adapters.Postgres and Ecto.Adapters.MySQL.

schema

Schema

The :schema field refers the module name for the schema this metadata belongs to.

Link to this section Summary

Link to this section Types

@type context() :: any()
@type state() :: :built | :loaded | :deleted
@type t() :: t(module())
@type t(schema) :: %Ecto.Schema.Metadata{
  context: context(),
  prefix: Ecto.Schema.prefix(),
  schema: schema,
  source: Ecto.Schema.source(),
  state: state()
}