# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.29.0
# source: count_queued_hype_cron_job_runs.sql
import dataclasses
from typing import Optional

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


COUNT_QUEUED_HYPE_CRON_JOB_RUNS = """-- name: count_queued_hype_cron_job_runs \\:one
  SELECT COUNT(*)\\:\\:int AS count
  FROM hype_cron_job_run_details
  WHERE status = 'QUEUED'
    AND schedule_time <= NOW()
"""


@dataclasses.dataclass()
class CountQueuedHypeCronJobRunsParams:

    pass

class Querier:
    def __init__(self, conn: sqlalchemy.engine.Connection):
        self._conn = conn

    def count_queued_hype_cron_job_runs(self, arg: CountQueuedHypeCronJobRunsParams) -> Optional[int]:
        row = self._conn.execute(sqlalchemy.text(COUNT_QUEUED_HYPE_CRON_JOB_RUNS)).first()
        if row is None:
            return None
        return row[0]


class AsyncQuerier:
    def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
        self._conn = conn

    async def count_queued_hype_cron_job_runs(self, arg: CountQueuedHypeCronJobRunsParams) -> Optional[int]:
        row = (await self._conn.execute(sqlalchemy.text(COUNT_QUEUED_HYPE_CRON_JOB_RUNS))).first()
        if row is None:
            return None
        return row[0]
