def get_or_none(cls: Type[MODEL], *args, **kwargs) -> FirstQuerySet[MODEL]: """ Fetches a single record for a Model type using the provided filter parameters or None. .. code-block:: python3 user = await User.get(username="******") """ return QuerySet(cls).get_or_none(*args, **kwargs)
def get(cls: Type[MODEL], *args, **kwargs) -> GetQuerySet[MODEL]: """ Fetches a single record for a Model type using the provided filter parameters. .. code-block:: python3 user = await User.get(username="******") :raises MultipleObjectsReturned: If provided search returned more than one object. :raises DoesNotExist: If object can not be found. """ return QuerySet(cls).get(*args, **kwargs)
def __init__(self, base: QuerySet, raw_sql: str): base._copy(self) self.raw_sql = raw_sql
def raw(cls: Type[MODEL], raw_sql) -> RawQuerySet[MODEL]: """ Returns the complete QuerySet. """ return QuerySet(cls).raw(raw_sql)
def all(cls: Type[MODEL]) -> QuerySet[MODEL]: """ Returns the complete QuerySet. """ return QuerySet(cls)
def annotate(cls: Type[MODEL], *args, **kwargs) -> QuerySet[MODEL]: return QuerySet(cls).annotate(*args, **kwargs)
def exclude(cls: Type[MODEL], *args, **kwargs) -> QuerySet[MODEL]: """ Generates a QuerySet with the exclude applied. """ return QuerySet(cls).exclude(*args, **kwargs)
def filter(cls: Type[MODEL], *args, **kwargs) -> QuerySet[MODEL]: """ Generates a QuerySet with the filter applied. """ return QuerySet(cls).filter(*args, **kwargs)
def first(cls: Type[MODEL]) -> FirstQuerySet[MODEL]: """ Generates a QuerySet that returns the first record. """ return QuerySet(cls).first()