Ecto v3.0.0-dev Ecto.Schema.Metadata View Source

Stores metadata of a struct.

State

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

  • :build - the stuct 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

The :source field is a tuple tracking the database source (table or collection) where the struct is or should be persisted. It is represented as a tuple consisting of two fields:

  • source - tracking the table or collection name.
  • prefix - tracking the ecto prefix of the table or collection.

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.Postres and Ecto.Adapters.MySQL.

Link to this section Summary

Link to this section Types

Link to this type context() View Source
context() :: any
Link to this type state() View Source
state() :: :built | :loaded | :deleted
Link to this type t() View Source
t() :: %Ecto.Schema.Metadata{context: context, source: source, state: state}