mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 05:23:18 +12:00
docs: Update docs in readme (#50)
This commit is contained in:
parent
72afa96a45
commit
93ad7d18ca
1 changed files with 14 additions and 6 deletions
16
README.md
16
README.md
|
@ -25,15 +25,23 @@ First, ensure you've added ash_postgres to your `mix.exs` file.
|
||||||
{:ash_postgres, "~> x.y.z"}
|
{:ash_postgres, "~> x.y.z"}
|
||||||
```
|
```
|
||||||
|
|
||||||
To use this data layer, you need to define an `Ecto.Repo`. AshPostgres adds some
|
To use this data layer, you need to chage your Ecto Repo's from `use Ecto.Repo`,
|
||||||
functionality on top of ecto repos, so you'll want to use `AshPostgres.Repo`
|
to `use AshPostgres.Repo`. because AshPostgres adds functionality to Ecto Repos.
|
||||||
|
|
||||||
Then, configure your resource like so:
|
Then, configure each of your `Ash.Resource` resources by adding `use Ash.Resource, data_layer: AshPostgres.DataLayer` like so:
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
postgres do
|
defmodule MyApp.SomeResource do
|
||||||
|
use Ash.Resource, data_layer: AshPostgres.DataLayer
|
||||||
|
|
||||||
|
postgres do
|
||||||
repo MyApp.Repo
|
repo MyApp.Repo
|
||||||
table "table_name"
|
table "table_name"
|
||||||
|
end
|
||||||
|
|
||||||
|
attributes do
|
||||||
|
# ... Attribute definitions
|
||||||
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue