Sig.Repo (Sig v0.1.0)

Copy Markdown View Source

Delegates Sig's database calls to your application's Ecto repo.

Sig does not start a repo of its own. Like Oban, it uses the one you configure:

config :sig, repo: MyApp.Repo

All of Sig's queries go through this module, which forwards them to that repo. Since they share the repo, Sig's writes take part in your transactions, and in tests they use the same SQL sandbox as the rest of your app.

Options

  • :repo (required) - the Ecto.Repo to use.

  • :prefix - the PostgreSQL schema where Sig's tables live. Defaults to nil, which uses the connection's search path (normally public). Set it to the same prefix you passed to Sig.Migration.up/1:

    config :sig, repo: MyApp.Repo, prefix: "sig"

The functions below mirror the Ecto.Repo ones of the same name and add the configured :prefix to the options when one is set.

Summary

Functions

Returns the configured prefix, or nil to use the connection's search path.

Returns the configured repo.

Functions

prefix()

@spec prefix() :: String.t() | nil

Returns the configured prefix, or nil to use the connection's search path.

repo()

@spec repo() :: module()

Returns the configured repo.

Raises ArgumentError if :repo is not configured.