Belt v0.5.1 Belt.Ecto.Config View Source

Ecto type for storing Belt.Provider config structs.

This Ecto type allows storing and retrieving Belt.Provider configurations without needing to perform manual conversions.

Usage

#in migrations

create table(:belt_providers) do
  add :config, :map #Belt.Ecto.Config uses Ecto primitive :map
end
#in schemas

schema "belt_providers" do
  field :config, Belt.Ecto.Config
end

Link to this section Summary

Functions

Only valid provider config structs can be cast

Serializes config struct to Map primitive while preserving atoms

Dictates how the type should be treated inside embeds

Checks if two terms are semantically equal

Loads config struct from serialized Map and restores existing atoms

Underlying Ecto primitive is a Map

Link to this section Functions

Only valid provider config structs can be cast.

Serializes config struct to Map primitive while preserving atoms.

Config structs that contain nested maps/structs or lists are currently not supported.

Dictates how the type should be treated inside embeds.

By default, the type is sent as itself, without calling dumping to keep the higher level representation. But it can be set to :dump so that it is dumped before being encoded.

Callback implementation for Ecto.Type.embed_as/1.

Checks if two terms are semantically equal.

Callback implementation for Ecto.Type.equal?/2.

Loads config struct from serialized Map and restores existing atoms.

Underlying Ecto primitive is a Map.