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

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


CREATE_EXECUTOR_TABLE = """-- name: create_executor_table \\:exec
CREATE TABLE IF NOT EXISTS hyrex_executor
(
    id             UUID    NOT NULL PRIMARY KEY,
    name           VARCHAR NOT NULL,
    worker_name    VARCHAR NOT NULL,
    queue_pattern  VARCHAR NOT NULL,
    queues         VARCHAR[] NOT NULL,
    started        TIMESTAMP WITH TIME ZONE,
    stopped        TIMESTAMP WITH TIME ZONE,
    last_heartbeat TIMESTAMP WITH TIME ZONE,
    stats          JSON,
    status         executor_status NOT NULL DEFAULT 'UNKNOWN'
)
"""


@dataclasses.dataclass()
class CreateExecutorTableParams:

    pass

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

    def create_executor_table(self, arg: CreateExecutorTableParams) -> None:
        self._conn.execute(sqlalchemy.text(CREATE_EXECUTOR_TABLE))


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

    async def create_executor_table(self, arg: CreateExecutorTableParams) -> None:
        await self._conn.execute(sqlalchemy.text(CREATE_EXECUTOR_TABLE))
