Belt v0.1.7 Belt.Ecto.Config

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

Summary

Functions

Only valid provider config structs can be cast

Serializes config struct to Map primitive while preserving atoms

Loads config struct from serialized Map and restores existing atoms

Underlying Ecto primitive is a Map

Functions

cast(config)

Only valid provider config structs can be cast.

cast!(value)
dump(config)

Serializes config struct to Map primitive while preserving atoms.

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

load(serialized_config)

Loads config struct from serialized Map and restores existing atoms.

type()

Underlying Ecto primitive is a Map.