View Source Oban.Repo (Oban v2.18.2)

Wrappers around Ecto.Repo and Ecto.Adapters.SQL callbacks.

Each function resolves the correct repo instance and sets options such as prefix and log according to Oban.Config.

Meant for Extending Oban

These functions should only be used when working with a repo inside engines, plugins, or other extensions for Oban. Favor using your application's repo directly when querying Oban.Job from your workers.

Examples

The first argument for every function must be an Oban.Config struct. Many functions pass configuration around as a conf key, and it can always be fetched with Oban.config/1. This demonstrates fetching the default instance config and querying all jobs:

Oban
|> Oban.config()
|> Oban.Repo.all(Oban.Job)

Summary

Functions

Wraps Ecto.Repo.all/2 with an additional Oban.Config argument.

Wraps Ecto.Repo.config/0 with an additional Oban.Config argument.

The default values extracted from Oban.Config for use in all queries with options.

Wraps Ecto.Repo.load/2 with an additional Oban.Config argument.

Wraps Ecto.Repo.one/2 with an additional Oban.Config argument.

Wraps Ecto.Repo.one!/2 with an additional Oban.Config argument.

Wraps Ecto.Adapters.SQL.Repo.query/4 with an added Oban.Config argument.

Wraps Ecto.Adapters.SQL.Repo.query!/4 with an added Oban.Config argument.

Wraps Ecto.Repo.rollback/1 with an additional Oban.Config argument.

Wraps Ecto.Adapters.SQL.Repo.to_sql/2 with an added Oban.Config argument.

Wraps Ecto.Repo.transaction/2 with an additional Oban.Config argument and automatic retries with backoff.

Functions

Link to this function

aggregate(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.aggregate/3 with an additional Oban.Config argument.

Link to this function

all(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.all/2 with an additional Oban.Config argument.

Link to this function

checkout(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.checkout/2 with an additional Oban.Config argument.

Link to this function

config(conf)

View Source (since 2.2.0)

Wraps Ecto.Repo.config/0 with an additional Oban.Config argument.

Link to this function

default_options(conf)

View Source (since 2.14.0)

The default values extracted from Oban.Config for use in all queries with options.

Link to this function

default_options(conf, arg1)

View Source (since 2.2.0)

Wraps Ecto.Repo.default_options/1 with an additional Oban.Config argument.

Link to this function

delete(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.delete/2 with an additional Oban.Config argument.

Link to this function

delete!(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.delete!/2 with an additional Oban.Config argument.

Link to this function

delete_all(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.delete_all/2 with an additional Oban.Config argument.

Link to this function

exists?(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.exists?/2 with an additional Oban.Config argument.

Link to this function

get(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.get/3 with an additional Oban.Config argument.

Link to this function

get!(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.get!/3 with an additional Oban.Config argument.

Link to this function

get_by(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.get_by/3 with an additional Oban.Config argument.

Link to this function

get_by!(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.get_by!/3 with an additional Oban.Config argument.

Link to this function

get_dynamic_repo(conf)

View Source (since 2.2.0)

Wraps Ecto.Repo.get_dynamic_repo/0 with an additional Oban.Config argument.

Link to this function

in_transaction?(conf)

View Source (since 2.2.0)

Wraps Ecto.Repo.in_transaction?/0 with an additional Oban.Config argument.

Link to this function

insert(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.insert/2 with an additional Oban.Config argument.

Link to this function

insert!(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.insert!/2 with an additional Oban.Config argument.

Link to this function

insert_all(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.insert_all/3 with an additional Oban.Config argument.

Link to this function

insert_or_update(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.insert_or_update/2 with an additional Oban.Config argument.

Link to this function

insert_or_update!(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.insert_or_update!/2 with an additional Oban.Config argument.

Link to this function

load(conf, arg1, arg2)

View Source (since 2.2.0)

Wraps Ecto.Repo.load/2 with an additional Oban.Config argument.

Link to this function

one(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.one/2 with an additional Oban.Config argument.

Link to this function

one!(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.one!/2 with an additional Oban.Config argument.

Link to this function

preload(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.preload/3 with an additional Oban.Config argument.

Link to this function

put_dynamic_repo(conf, arg1)

View Source (since 2.2.0)

Wraps Ecto.Repo.put_dynamic_repo/1 with an additional Oban.Config argument.

Link to this function

query(conf, statement, params \\ [], opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Adapters.SQL.Repo.query/4 with an added Oban.Config argument.

Link to this function

query!(conf, statement, params \\ [], opts \\ [])

View Source (since 2.17.0)

Wraps Ecto.Adapters.SQL.Repo.query!/4 with an added Oban.Config argument.

Link to this function

reload(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.reload/2 with an additional Oban.Config argument.

Link to this function

reload!(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.reload!/2 with an additional Oban.Config argument.

Link to this function

rollback(conf, arg1)

View Source (since 2.2.0)

Wraps Ecto.Repo.rollback/1 with an additional Oban.Config argument.

Link to this function

stream(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.stream/2 with an additional Oban.Config argument.

Link to this function

to_sql(conf, kind, queryable)

View Source (since 2.2.0)

Wraps Ecto.Adapters.SQL.Repo.to_sql/2 with an added Oban.Config argument.

Link to this function

transaction(conf, fun_or_multi, opts \\ [])

View Source (since 2.18.1)

Wraps Ecto.Repo.transaction/2 with an additional Oban.Config argument and automatic retries with backoff.

Options

Backoff helpers, in addition to the standard transaction options:

  • delay — the time to sleep between retries, defaults to 500ms
  • retry — the number of retries for unexpected errors, defaults to 5
  • expected_delay — the time to sleep between expected errors, e.g. serialization or lock_not_available, defaults to 10ms
  • expected_retry — the number of retries for expected errors, defaults to 20
Link to this function

update(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.update/2 with an additional Oban.Config argument.

Link to this function

update!(conf, arg1, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.update!/2 with an additional Oban.Config argument.

Link to this function

update_all(conf, arg1, arg2, opts \\ [])

View Source (since 2.2.0)

Wraps Ecto.Repo.update_all/3 with an additional Oban.Config argument.