# `Scrypath.Oban`
[🔗](https://github.com/szTheory/scrypath/blob/v0.3.21/lib/scrypath/oban.ex#L1)

Narrow Oban helpers for composing Scrypath sync jobs into `Ecto.Multi`.

`enqueue_upsert/5` and `enqueue_delete/5` add one job per `Ecto.Multi` step, whatever the
number of records or ids. Unlike `Scrypath.sync_records/3` under `sync_mode: :oban`, they do
not split the ids into several jobs; the worker bounds each backend write to at most 1000
documents or ids.

These helpers insert the job inside your transaction, and they insert it without the shared
`unique:` policy: the job only becomes visible when your transaction commits, so it always
reads committed rows and never collapses into a pending job that could run before your
commit. The cost is that an identical pending job may run twice, which is harmless because
upserts and deletes are keyed by id.

# `enqueue_delete`

```elixir
@spec enqueue_delete(Ecto.Multi.t(), Ecto.Multi.name(), module(), [term()], keyword()) ::
  Ecto.Multi.t()
```

# `enqueue_upsert`

```elixir
@spec enqueue_upsert(
  Ecto.Multi.t(),
  Ecto.Multi.name(),
  module(),
  [struct() | map()],
  keyword()
) ::
  Ecto.Multi.t()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
