View Source PaperTrail.Serializer (paper_trail v1.0.0)

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

@type model() :: struct() | Ecto.Changeset.t()
@type options() :: Keyword.t()
@type primary_key() :: integer() | String.t()

Link to this section Functions

Link to this function

add_prefix(schema, prefix)

View Source
@spec add_prefix(Ecto.Schema.schema(), nil | String.t()) :: Ecto.Schema.schema()

Adds a prefix to the Ecto schema

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

Returns the model type, which is the last module name

@spec get_model_id(model()) :: primary_key()

Returns the model primary id

Link to this function

get_sequence_id(table_name)

View Source
@spec 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
@spec make_version_struct(map(), model(), options()) :: PaperTrail.Version.t()

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

@spec 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
@spec serialize_changes(Ecto.Changeset.t()) :: map()

Dumps changes using Ecto fields