Stores metadata of a struct.
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.The :source
tracks the (table or collection) where the struct is or should be persisted to.
Tracks the source prefix in the data storage.
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
.
The :schema
field refers the module name for the schema this metadata belongs to.
context() :: any()
state() :: :built | :loaded | :deleted
t() :: %Ecto.Schema.Metadata{ context: context(), prefix: Ecto.Schema.prefix(), schema: module(), source: Ecto.Schema.source(), state: state() }
© 2013 Plataformatec
© 2020 Dashbit
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/ecto/Ecto.Schema.Metadata.html