Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/ecto.ex
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,13 @@ defmodule Ecto do

@doc """
Gets the metadata from the given struct.

For example, to check whether it has been persisted:

iex> Ecto.get_meta(changeset.data, :state)
:built

See `Ecto.Schema.Metadata`.
"""
def get_meta(struct, :context),
do: struct.__meta__.context
Expand All @@ -625,7 +632,7 @@ defmodule Ecto do
* `:context` - changes the struct meta context
* `:state` - changes the struct state

Please refer to the `Ecto.Schema.Metadata` module for more information.
See `Ecto.Schema.Metadata`.
"""
@spec put_meta(Ecto.Schema.schema(), meta) :: Ecto.Schema.schema()
when meta: [
Expand Down
Loading