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

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


GET_APP_NAME = """-- name: get_app_name \\:one
SELECT app_info->>'name' as app_name
FROM hyrex_app
LIMIT 1
"""


@dataclasses.dataclass()
class GetAppNameParams:

    pass

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

    def get_app_name(self, arg: GetAppNameParams) -> Optional[Optional[Any]]:
        row = self._conn.execute(sqlalchemy.text(GET_APP_NAME)).first()
        if row is None:
            return None
        return row[0]


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

    async def get_app_name(self, arg: GetAppNameParams) -> Optional[Optional[Any]]:
        row = (await self._conn.execute(sqlalchemy.text(GET_APP_NAME))).first()
        if row is None:
            return None
        return row[0]
