docs: Update docs in readme (#50)

This commit is contained in:
Jason Axelson 2021-03-14 11:22:59 -10:00 committed by GitHub
parent 72afa96a45
commit 93ad7d18ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
``` ```