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

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


REGISTER_APP_INFO = """-- name: register_app_info \\:exec
INSERT INTO hyrex_app (
    id,
    app_info
) VALUES (
    :p1,
    :p2
)
ON CONFLICT (id) DO UPDATE SET
    app_info = :p2
"""


@dataclasses.dataclass()
class RegisterAppInfoParams:
    id: int
    app_info: Optional[Any]


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

    def register_app_info(self, arg: RegisterAppInfoParams) -> None:
        self._conn.execute(sqlalchemy.text(REGISTER_APP_INFO), {"p1": arg.id, "p2": arg.app_info})


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

    async def register_app_info(self, arg: RegisterAppInfoParams) -> None:
        await self._conn.execute(sqlalchemy.text(REGISTER_APP_INFO), {"p1": arg.id, "p2": arg.app_info})
