PgFlowDashboard.Queries.Crons (PgFlow v0.1.0)

Copy Markdown View Source

Database queries for cron-related data.

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

Summary

Functions

Counts all crons.

Gets a cron's statistics and schedule info.

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

Lists crons with statistics and schedule info.

Functions

count_crons(repo)

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

Counts all crons.

get_cron(repo, flow_slug)

@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(repo, flow_slug, opts \\ [])

@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(repo, opts \\ [])

@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)