ash-project / ash_postgres

A postgresql datalayer for the Ash Framework

Home Page:https://hexdocs.pm/ash_postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AshPostgres

Elixir CI License: MIT Coverage Status Hex version badge

AshPostgres supports all the capabilities of an Ash data layer. AshPostgres is the primary Ash data layer.

Custom Predicates:

  • AshPostgres.Predicates.Trigram

DSL

See the DSL documentation in AshPostgres.DataLayer for DSL documentation

Usage

Add ash_postgres to your mix.exs file.

{:ash_postgres, "~> 1.3.6"}

To use this data layer, you need to chage your Ecto Repo's from use Ecto.Repo, to use AshPostgres.Repo. because AshPostgres adds functionality to Ecto Repos.

Then, configure each of your Ash.Resource resources by adding use Ash.Resource, data_layer: AshPostgres.DataLayer like so:

defmodule MyApp.SomeResource do
  use Ash.Resource, data_layer: AshPostgres.DataLayer

  postgres do
    repo MyApp.Repo
    table "table_name"
  end

  attributes do
    # ... Attribute definitions
  end
end

Generating Migrations

See the documentation for Mix.Tasks.AshPostgres.GenerateMigrations for how to generate migrations from your resources

Contributors

Ash is made possible by its excellent community!

Become a contributor

About

A postgresql datalayer for the Ash Framework

https://hexdocs.pm/ash_postgres

License:MIT License


Languages

Language:Elixir 100.0%