Update README
This commit is contained in:
parent
8dde5562d1
commit
16c5beecd7
20
README.md
20
README.md
|
|
@ -29,7 +29,7 @@ defmodule MyApp.Book do
|
||||||
use MyApp.Web, :model
|
use MyApp.Web, :model
|
||||||
|
|
||||||
schema "books" do
|
schema "books" do
|
||||||
field :isbn, ISN.ISBN13
|
field :isbn, ISN.ISBN13, read_after_writes: true
|
||||||
# other fields
|
# other fields
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -49,11 +49,19 @@ end
|
||||||
|
|
||||||
mix do isn.gen.migration, ecto.migrate
|
mix do isn.gen.migration, ecto.migrate
|
||||||
|
|
||||||
**Register the postgrex extension in your Repo config**
|
**In lib/ directory create a file with the following content:**
|
||||||
```elixir
|
```elixir
|
||||||
config :books, MyApp.Repo,
|
Postgrex.Types.define(
|
||||||
adapter: Ecto.Adapters.Postgres,
|
MyApp.PostgrexTypes,
|
||||||
extensions: [{ISN, []}]
|
[ISN] ++ Ecto.Adapters.Postgres.extensions(),
|
||||||
|
json: Poison
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Add the following lines in conig.exs:**
|
||||||
|
```elixir
|
||||||
|
config :my_app, MyApp.Repo,
|
||||||
|
types: MyApp.PostgrexTypes
|
||||||
```
|
```
|
||||||
|
|
||||||
## Defined types
|
## Defined types
|
||||||
|
|
@ -75,4 +83,4 @@ Ecto.Type | Postgrex type
|
||||||
[2]: http://hexdocs.pm/ecto/Ecto.Type.html
|
[2]: http://hexdocs.pm/ecto/Ecto.Type.html
|
||||||
[3]: http://www.postgresql.org/docs/9.4/static/isn.html
|
[3]: http://www.postgresql.org/docs/9.4/static/isn.html
|
||||||
[4]: https://semaphoreci.com/api/v1/projects/be7c4c34-c49e-45c7-9320-3fcc4f7f476a/458429/badge.svg
|
[4]: https://semaphoreci.com/api/v1/projects/be7c4c34-c49e-45c7-9320-3fcc4f7f476a/458429/badge.svg
|
||||||
[5]: https://semaphoreci.com/frost/isn
|
[5]: https://semaphoreci.com/frost/isn
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ defmodule ISN do
|
||||||
A Postgrex.Extension enabling the use of postgresql data types from the isn
|
A Postgrex.Extension enabling the use of postgresql data types from the isn
|
||||||
extension.
|
extension.
|
||||||
|
|
||||||
In lib/ directory create a file called postgrex_types.ex with the following content:
|
In lib/ directory create a file with the following content:
|
||||||
|
|
||||||
Postgrex.Types.define(
|
Postgrex.Types.define(
|
||||||
MyApp.PostgrexTypes,
|
MyApp.PostgrexTypes,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue