View Source ISN (ISN v3.0.1)
A Postgrex.Extension enabling the use of postgresql data types from the isn extension.
In lib/ directory create a file with the following content:
Postgrex.Types.define(MyApp.PostgrexTypes, [ISN], [])
Add the following lines in conig.exs:
config :my_app, MyApp.Repo,
types: MyApp.PostgrexTypes
Then you can do Ecto.Migrations like this:
defmodule MyApp.Repo.Migrations.CreateBook do
use Ecto.Migration
def change do
create table(:books) do
add :isbn, :isbn13
# other fields
end
end
end
You can also define Ecto.Models using the matching custom Ecto.Types:
defmodule MyApp.Book do
use MyApp.Web, :model
schema "books" do
field :isbn, ISN.ISBN13, read_after_writes: true
# other fields
end
end
Summary
Functions
Callback implementation for Postgrex.Extension.decode/1
.
Callback implementation for Postgrex.Extension.encode/1
.
Callback implementation for Postgrex.Extension.format/1
.
Callback implementation for Postgrex.Extension.init/1
.
Callback implementation for Postgrex.Extension.matching/1
.
Functions
Callback implementation for Postgrex.Extension.decode/1
.
Callback implementation for Postgrex.Extension.encode/1
.
Callback implementation for Postgrex.Extension.format/1
.
Callback implementation for Postgrex.Extension.init/1
.
Callback implementation for Postgrex.Extension.matching/1
.