AshPostgresPartition (ash_postgres_partition v0.2.0)

Copy Markdown View Source

Ash Postgres Partition is an extension for Ash Resources It makes it easier to add partitions and to manage them It also supports having tenants

Summary

Functions

Creates the partition for key unless it already exists.

Checks if the default partition exists, see generate_default_partition?.

Checks if the partition for key exists.

Functions

create(resource, key, opts \\ [])

@spec create(resource :: module(), key :: term(), opts :: Keyword.t()) ::
  :ok | {:error, term()}

Creates the partition for key unless it already exists.

For :hash partitions key is ignored and all count partitions are created.

Options

  • :tenant - the tenant to create the partition for, only used when the resource uses :context multitenancy

default_exists?(resource, opts \\ [])

@spec default_exists?(resource :: module(), opts :: Keyword.t()) ::
  boolean() | {:error, term()}

Checks if the default partition exists, see generate_default_partition?.

Options

  • :tenant - the tenant to check the partition for, only used when the resource uses :context multitenancy

exists?(resource, key, opts \\ [])

@spec exists?(resource :: module(), key :: term(), opts :: Keyword.t()) ::
  boolean() | {:error, term()}

Checks if the partition for key exists.

For :hash partitions key is the remainder of the partition to check.

Options

  • :tenant - the tenant to check the partition for, only used when the resource uses :context multitenancy

partition(body)

(macro)