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

Functions

Callback implementation for c:Postgrex.Extension.decode/4

Callback implementation for c:Postgrex.Extension.encode/4

Callback implementation for c:Postgrex.Extension.format/1

Callback implementation for c:Postgrex.Extension.init/2

Callback implementation for c:Postgrex.Extension.matching/1

Functions

decode(type_info, binary, types, opts)

Callback implementation for c:Postgrex.Extension.decode/4.

encode(type_info, binary, types, opts)

Callback implementation for c:Postgrex.Extension.encode/4.

format()

Callback implementation for c:Postgrex.Extension.format/1.

init(parameters, opts)

Callback implementation for c:Postgrex.Extension.init/2.

matching(library)

Callback implementation for c:Postgrex.Extension.matching/1.