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

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


GET_DISTINCT_TASK_DEF_NAMES = """-- name: get_distinct_task_def_names \\:many
SELECT DISTINCT task_name
FROM hyrex_task_def
WHERE task_name IS NOT NULL
ORDER BY task_name
"""


@dataclasses.dataclass()
class GetDistinctTaskDefNamesParams:

    pass

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

    def get_distinct_task_def_names(self, arg: GetDistinctTaskDefNamesParams) -> Iterator[str]:
        result = self._conn.execute(sqlalchemy.text(GET_DISTINCT_TASK_DEF_NAMES))
        for row in result:
            yield row[0]


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

    async def get_distinct_task_def_names(self, arg: GetDistinctTaskDefNamesParams) -> AsyncIterator[str]:
        result = await self._conn.stream(sqlalchemy.text(GET_DISTINCT_TASK_DEF_NAMES))
        async for row in result:
            yield row[0]
