# `PgFlowDashboard.Queries.Crons`
[🔗](https://github.com/agoodway/pgflow/blob/v0.1.0/lib/pgflow_dashboard/queries/crons.ex#L1)

Database queries for cron-related data.

Enriches cron data with calculated next run time using the Crontab library.

# `count_crons`

```elixir
@spec count_crons(module()) :: integer()
```

Counts all crons.

# `get_cron`

```elixir
@spec get_cron(module(), String.t()) :: {:ok, map()} | {:error, :not_found | term()}
```

Gets a cron's statistics and schedule info.

Enriches the cron with:
- `next_run_at` - The next scheduled run time (calculated from cron expression)
- `human_schedule` - Human-readable schedule description

# `get_run_history_grid`

```elixir
@spec get_run_history_grid(module(), String.t(), keyword()) :: [map()]
```

Gets run history data for a cron's activity grid.

Returns a list of run result cells for the single perform step.

# `list_crons`

```elixir
@spec list_crons(
  module(),
  keyword()
) :: [map()]
```

Lists crons with statistics and schedule info.

Enriches each cron with:
- `next_run_at` - The next scheduled run time (calculated from cron expression)
- `human_schedule` - Human-readable schedule description

## Options
  * `:limit` - Maximum number of crons to return
  * `:cursor` - Cursor for pagination (flow_slug to start after)

---

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