ISN
ISN adds a Postgrex.Extension
and Ecto.Type
definitions
for the datatypes defined in the isn
PostgreSQL module.
Ecto migrations
defmodule MyApp.Repo.Migrations.CreateBook do
use Ecto.Migration
def change do
create table(:books) do
add :isbn, :isbn13
# other fields
end
end
end
Ecto Models
defmodule MyApp.Book do
use MyApp.Web, :model
schema "books" do
field :isbn, ISN.ISBN13, read_after_writes: true
# other fields
end
end
Defined types
ISN
adds the following ecto and corresponding postgrex types:
Ecto.Type | Postgrex type |
---|---|
ISN.ISBN |
:isbn |
ISN.ISBN13 |
:isbn13 |
ISN.ISMN |
:ismn |
ISN.ISMN13 |
:ismn13 |
ISN.ISSN |
:issn |
ISN.ISSN13 |
:issn13 |
ISN.EAN13 |
:ean13 |
ISN.UPC |
:upc |