Isn
A Postgrex.Extension enabling the use of postgresql data types from the isn extension.
Add this module as an extension when establishing your Postgrex connection:
Postgrex.Connection.start_link(
database: "isn_test",
extensions: [{Isn, {}}])
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
# other fields
end
end
Summary↑
decode(typeinfo, binary, types, opts) | Callback implementation of |
encode(typeinfo, binary, types, opts) | Callback implementation of |
format() | Callback implementation of |
init(parameters, opts) | Callback implementation of |
matching(library) | Callback implementation of |
Functions
Callback implementation of Postgrex.Extension.decode/4
.
Callback implementation of Postgrex.Extension.encode/4
.
Callback implementation of Postgrex.Extension.format/1
.
Callback implementation of Postgrex.Extension.init/2
.
Callback implementation of Postgrex.Extension.matching/1
.