An Ecto.Type storing a script as its code in a text column.
A script is identified by its ISO 15924 code — :Latn, :Cyrl,
:Hant — and that code is what is stored, in an ordinary text column.
Values cast and load as the validated code atom, so an unknown script
is rejected on the way in.
Schema
# in a migration
add :script, :string
# in a schema
field :script, Localize.Script.Ecto.TypeCasting
cast/1 accepts a code as an atom (:Latn) or a string ("Latn"), and
validates it against Localize.validate_script/1.
Summary
Functions
Callback implementation for Ecto.Type.embed_as/1.
Callback implementation for Ecto.Type.equal?/2.
Functions
Callback implementation for Ecto.Type.embed_as/1.
Callback implementation for Ecto.Type.equal?/2.