ash_postgres v0.20.1 AshPostgres.DataLayer View Source

A postgres data layer that levereges Ecto's postgres capabilities.

AshPostgres supports all capabilities of an Ash data layer, and it will most likely stay that way, as postgres is the primary target/most maintained data layer.

Custom Predicates:

  • AshPostgres.Predicates.Trigram

Usage

To use this data layer, you need to define an AshPostgres.Repo. Ash adds some functionality on top of ecto repos, so you'll want to use AshPostgres.Repo

Then, configure your resource like so:

postgres do
  repo MyApp.Repo
  table "table_name"
end

Generating Migrations

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

Link to this section Summary

Functions

Postgres data layer configuration

Link to this section Functions

Link to this macro

postgres(body)

View Source (macro)

Postgres data layer configuration

Options

  • :repo - Required. The repo that will be used to fetch your data. See the AshPostgres.Repo documentation for more

  • :migrate? - Whether or not to include this resource in the generated migrations with mix ash.generate_migrations The default value is true.

  • :table - Required. The table to store and read the resource from