# `GoodJob.Job`
[🔗](https://github.com/amkisko/good_job.ex/blob/v1.0.0/lib/good_job/job.ex#L1)

Ecto schema for good_jobs table.

Represents a job in the queue.

# `t`

```elixir
@type t() :: %GoodJob.Job{
  __meta__: term(),
  active_job_id: term(),
  batch_callback_id: term(),
  batch_id: term(),
  concurrency_key: term(),
  cron_at: term(),
  cron_key: term(),
  error: term(),
  error_event: term(),
  executions_count: term(),
  finished_at: term(),
  id: term(),
  inserted_at: term(),
  is_discrete: term(),
  job_class: term(),
  labels: term(),
  lock_type: term(),
  locked_at: term(),
  locked_by_id: term(),
  performed_at: term(),
  priority: term(),
  queue_name: term(),
  retried_good_job_id: term(),
  scheduled_at: term(),
  serialized_params: term(),
  updated_at: term()
}
```

# `advisory_locked`

# `advisory_unlocked`

# `build_for_enqueue`

Builds a job for enqueueing.

# `calculate_state`

# `changeset`

Creates a changeset for a job.

# `created_after`

# `created_before`

# `delete`

Deletes a job from the database.

# `delete_many`

```elixir
@spec delete_many([Ecto.UUID.t() | String.t()]) ::
  {:ok, non_neg_integer()} | {:error, term()}
```

Deletes multiple jobs in two queries (fetch by id, then delete all matching rows).

Emits the same PubSub and telemetry events per job as `delete/1`.
`ids` may be a list of `t:Ecto.UUID` strings (as returned from the database or UI).

# `dequeueing_ordered`

# `discarded`

```elixir
@spec discarded(Ecto.Query.t() | module()) :: Ecto.Query.t()
```

# `enqueue`

Enqueues a job.

This inserts the row only; it does not run `GoodJob.Concurrency` checks. Use `GoodJob.enqueue/3`
when you need per-key enqueue limits enforced before insert.

## Options

  * `:listen_notify` - When `false`, skips `pg_notify` (PubSub and telemetry still run).
    Used by `GoodJob.Bulk` to send a single notification after a batch insert.

# `exclude_paused`

# `find_by_active_job_id`

# `find_by_id`

# `finished`

# `finished_before`

# `in_batch`

# `in_queue`

# `joins_advisory_locks`

# `locked`

# `only_scheduled`

# `order_by_created_asc`

# `order_by_created_desc`

# `order_by_finished_desc`

# `order_by_scheduled_asc`

# `order_for_candidate_lookup`

# `queue_ordered`

# `queued`

# `retry`

Retries a discarded job by clearing its finished_at and error fields.

# `retry_many`

```elixir
@spec retry_many([Ecto.UUID.t() | String.t()]) ::
  {:ok, non_neg_integer()} | {:error, term()}
```

Retries multiple jobs in one `UPDATE`, matching `retry/1` field changes.

Emits the same PubSub and telemetry events per job as `retry/1` (using structs
loaded before the update).

# `running`

# `scheduled`

# `scheduled_before`

# `succeeded`

```elixir
@spec succeeded(Ecto.Query.t() | module()) :: Ecto.Query.t()
```

# `unfinished`

# `unlocked`

# `with_all_labels`

# `with_any_label`

# `with_batch_id`

# `with_concurrency_key`

# `with_cron_key`

# `with_errors`

# `with_job_class`

# `with_label`

# `with_labels`

# `with_max_priority`

# `with_min_priority`

# `with_priority`

# `without_errors`

---

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