ash_sqlite/README.md

56 lines
1.7 KiB
Markdown
Raw Normal View History

2023-09-23 14:52:22 +12:00
# AshSqlite
![Elixir CI](https://github.com/ash-project/ash_sqlite/workflows/Elixir%20CI/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Coverage Status](https://coveralls.io/repos/github/ash-project/ash_sqlite/badge.svg?branch=main)](https://coveralls.io/github/ash-project/ash_sqlite?branch=main)
[![Hex version badge](https://img.shields.io/hexpm/v/ash_sqlite.svg)](https://hex.pm/packages/ash_sqlite)
2023-10-12 13:23:16 +13:00
## Notice: Beta
2023-09-23 17:39:13 +12:00
2023-10-12 13:23:16 +13:00
This is a newly released library. You can expect some hiccups here and there. Please report any issues you find!
2023-09-23 17:39:13 +12:00
2023-09-23 14:52:22 +12:00
## DSL
See the DSL documentation in `AshSqlite.DataLayer` for DSL documentation
## Usage
Add `ash_qlite` to your `mix.exs` file.
```elixir
2024-04-16 01:42:47 +12:00
{:ash_sqlite, "~> 0.1.2-rc.0"}
2023-09-23 14:52:22 +12:00
```
2023-09-23 17:39:13 +12:00
To use this data layer, you need to chage your Ecto Repo's from `use Ecto.Repo`, to `use Sqlite.Repo`. because AshSqlite adds functionality to Ecto Repos.
2023-09-23 14:52:22 +12:00
Then, configure each of your `Ash.Resource` resources by adding `use Ash.Resource, data_layer: AshSqlite.DataLayer` like so:
```elixir
defmodule MyApp.SomeResource do
use Ash.Resource, domain: MyDomain, data_layer: AshSqlite.DataLayer
2023-09-23 14:52:22 +12:00
sqlite do
repo MyApp.Repo
table "table_name"
end
attributes do
# ... Attribute definitions
end
end
```
## Generating Migrations
See the documentation for `Mix.Tasks.AshSqlite.GenerateMigrations` for how to generate migrations from your resources
# Contributors
Ash is made possible by its excellent community!
<a href="https://github.com/ash-project/ash_sqlite/graphs/contributors">
<img src="https://contrib.rocks/image?repo=ash-project/ash_sqlite" />
</a>
[Become a contributor](https://ash-hq.org/docs/guides/ash/latest/how_to/contribute.md)