# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.29.0
# source: _04_create_hyrex_scheduler_lock_table.sql
import dataclasses

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


CREATE_SCHEDULER_LOCK_TABLE = """-- name: create_scheduler_lock_table \\:exec
CREATE TABLE IF NOT EXISTS hyrex_scheduler_lock
(
    lockid       bigserial PRIMARY KEY,
    worker_name  text        NOT NULL,
    acquired_at  timestamptz NOT NULL DEFAULT now(),
    heartbeat_at timestamptz NOT NULL DEFAULT now(),
    release_at   timestamptz NOT NULL,
    is_active    boolean     NOT NULL DEFAULT true
)
"""


@dataclasses.dataclass()
class CreateSchedulerLockTableParams:

    pass

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

    def create_scheduler_lock_table(self, arg: CreateSchedulerLockTableParams) -> None:
        self._conn.execute(sqlalchemy.text(CREATE_SCHEDULER_LOCK_TABLE))


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

    async def create_scheduler_lock_table(self, arg: CreateSchedulerLockTableParams) -> None:
        await self._conn.execute(sqlalchemy.text(CREATE_SCHEDULER_LOCK_TABLE))
