# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.29.0
# source: batch_update_heartbeat_on_executors.sql
import dataclasses
from typing import List
import uuid

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


BATCH_UPDATE_HEARTBEAT_ON_EXECUTORS = """-- name: batch_update_heartbeat_on_executors \\:exec
UPDATE hyrex_executor
SET last_heartbeat = NOW()
WHERE id = ANY (:p1\\:\\:uuid[])
"""


@dataclasses.dataclass()
class BatchUpdateHeartbeatOnExecutorsParams:
    executor_ids: List[uuid.UUID]


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

    def batch_update_heartbeat_on_executors(self, arg: BatchUpdateHeartbeatOnExecutorsParams) -> None:
        self._conn.execute(sqlalchemy.text(BATCH_UPDATE_HEARTBEAT_ON_EXECUTORS), {"p1": arg.executor_ids})


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

    async def batch_update_heartbeat_on_executors(self, arg: BatchUpdateHeartbeatOnExecutorsParams) -> None:
        await self._conn.execute(sqlalchemy.text(BATCH_UPDATE_HEARTBEAT_ON_EXECUTORS), {"p1": arg.executor_ids})
