# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.29.0
# source: advance_workflow_run_func.sql
import dataclasses
from typing import Any, AsyncIterator, Iterator, Optional
import uuid

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


ADVANCE_WORKFLOW_RUN_FUNC = """-- name: advance_workflow_run_func \\:many
SELECT advance_workflow_run FROM advance_workflow_run(:p1\\:\\:UUID)
"""


@dataclasses.dataclass()
class AdvanceWorkflowRunFuncParams:
    workflow_run_id: uuid.UUID


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

    def advance_workflow_run_func(self, arg: AdvanceWorkflowRunFuncParams) -> Iterator[Optional[Any]]:
        result = self._conn.execute(sqlalchemy.text(ADVANCE_WORKFLOW_RUN_FUNC), {"p1": arg.workflow_run_id})
        for row in result:
            yield row[0]


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

    async def advance_workflow_run_func(self, arg: AdvanceWorkflowRunFuncParams) -> AsyncIterator[Optional[Any]]:
        result = await self._conn.stream(sqlalchemy.text(ADVANCE_WORKFLOW_RUN_FUNC), {"p1": arg.workflow_run_id})
        async for row in result:
            yield row[0]
