from sqlmodel import Session, func, text, SQLModel, select
from typing import Any, List, Literal, Optional, Type, TypeVar, Generic

ReadType = TypeVar("ReadType", bound=SQLModel)
CreateType = TypeVar("CreateType", bound=SQLModel)
UpdateType = TypeVar("UpdateType", bound=SQLModel)


class BaseRepository(Generic[ReadType, CreateType, UpdateType]):
    entity: Type[ReadType]

    def __init__(self, db: Session):
        self.db = db

    def get_entity(self, *args: Any, **kwargs: Any) -> Optional[ReadType]:
        result = self.db.exec(
            