mirror of
https://github.com/ash-project/ash_csv.git
synced 2024-09-19 12:53:31 +12:00
docs: update version, add example usage, fix DSL example (#8)
This commit is contained in:
parent
2f00b5d3f4
commit
6ae2f85d0b
2 changed files with 17 additions and 3 deletions
|
@ -7,7 +7,21 @@ AshCsv offers basic support for storing and reading resources from csv files.
|
||||||
Add `ash_csv` to your list of dependencies in `mix.exs`:
|
Add `ash_csv` to your list of dependencies in `mix.exs`:
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
{:ash_csv, "~> 0.9.7-rc.0"}
|
{:ash_csv, "~> 0.9.7"}
|
||||||
```
|
```
|
||||||
|
|
||||||
For information on how to configure it, see the [DSL documentation.](/documentation/dsls/DSL:-AshCsv.DataLayer.md)
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
defmodule MyApp.MyResource do
|
||||||
|
use Ash.Resource,
|
||||||
|
domain: MyApp,
|
||||||
|
data_layer: AshCsv.DataLayer
|
||||||
|
|
||||||
|
csv do
|
||||||
|
... # see configuration options below
|
||||||
|
end
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
For information on how to configure ash_csv, see the [DSL documentation.](/documentation/dsls/DSL:-AshCsv.DataLayer.md)
|
||||||
|
|
|
@ -32,7 +32,7 @@ defmodule AshCsv.DataLayer do
|
||||||
file "priv/data/tags.csv"
|
file "priv/data/tags.csv"
|
||||||
create? true
|
create? true
|
||||||
header? true
|
header? true
|
||||||
separator '-'
|
separator ?;
|
||||||
columns [:id, :name]
|
columns [:id, :name]
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue