PaperTrail.Serializer (paper_trail v0.12.0) View Source

Serialization functions to create a version struct

Link to this section Summary

Functions

Adds a prefix to the Ecto schema

Returns the model type, which is the last module name

Returns the model primary id

Returns the last primary key value of a table

Creates a version struct for a model and a specific changeset action

Shows DB representation of an Ecto model, filters relationships and virtual attributes from an Ecto.Changeset or %ModelStruct{}

Dumps changes using Ecto fields

Link to this section Types

Specs

model() :: struct() | Ecto.Changeset.t()

Specs

options() :: Keyword.t()

Specs

primary_key() :: integer() | String.t()

Link to this section Functions

Link to this function

add_prefix(schema, prefix)

View Source

Specs

add_prefix(Ecto.Schema.schema(), nil | String.t()) :: Ecto.Schema.schema()

Adds a prefix to the Ecto schema

Specs

get_item_type(model()) :: String.t()

Returns the model type, which is the last module name

Specs

get_model_id(model()) :: primary_key()

Returns the model primary id

Link to this function

get_sequence_id(table_name)

View Source

Specs

get_sequence_id(model() | String.t()) :: primary_key()

Returns the last primary key value of a table

Link to this function

make_version_struct(map, model, options)

View Source

Specs

make_version_struct(map(), model(), options()) :: PaperTrail.Version.t()

Creates a version struct for a model and a specific changeset action

Specs

serialize(nil | Ecto.Changeset.t() | struct()) :: nil | map()

Shows DB representation of an Ecto model, filters relationships and virtual attributes from an Ecto.Changeset or %ModelStruct{}

Link to this function

serialize_changes(changeset)

View Source

Specs

serialize_changes(Ecto.Changeset.t()) :: map()

Dumps changes using Ecto fields