|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- from __future__ import annotations
-
- from typing import Any, Generic, Type, TypeVar, overload
-
- from eloquent.orm.relations.dynamic_property import DynamicProperty
-
- _TModel = TypeVar ('_TModel', bound = 'Model')
-
-
- class Connection:
- def select (self, query: str, bindings: dict[str, Any] | None = None) -> Any: ...
-
- def insert (self, query: str, bindings: dict[str, Any] | None = None) -> int: ...
-
- def update (self, query: str, bindings: dict[str, Any] | None = None) -> int: ...
-
- def delete (self, query: str, bindings: dict[str, Any] | None = None) -> int: ...
-
- def transaction (self, callback: Any) -> Any: ...
-
- def begin_transaction (self) -> None: ...
-
- def commit (self) -> None: ...
-
- def rollback (self) -> None: ...
-
-
- class ConnectionResolver:
- def connection (self, name: str | None = None) -> Any: ...
-
- def get_default_connection (self) -> str: ...
-
- def set_default_connection (self, name: str) -> None: ...
-
-
- class DatabaseManager:
- connections: dict[str, Connection]
-
- def __init__ (self, config: dict[str, Any]) -> None: ...
-
- def connection (self, name: str | None = None) -> Connection: ...
-
- def disconnect (self, name: str | None = None) -> None: ...
-
- def reconnect (self, name: str | None = None) -> Connection: ...
-
- def get_connections (self) -> dict[str, Connection]: ...
-
-
- class Model:
- id: int
-
- def has_one (
- self,
- related_model: Type[Model],
- foreign_key: str | None = None,
- ) -> DynamicProperty: ...
-
- def has_many (
- self,
- related_model: Type[Model],
- foreign_key: str | None = None,
- ) -> DynamicProperty: ...
-
- def belongs_to (
- self,
- related_model: Type[Model],
- foreign_key: str | None = None,
- ) -> DynamicProperty: ...
-
- def belongs_to_many (
- self,
- related_model: Type[Model],
- foreign_key: str | None = None,
- ) -> DynamicProperty: ...
-
- def save (self) -> None: ...
-
- def delete (self) -> None: ...
-
- @classmethod
- def find (cls, id: int) -> Model | None: ...
-
- @overload
- @classmethod
- def where (cls, field: str, operator: str, value: Any) -> QueryBuilder: ...
-
- @overload
- @classmethod
- def where (cls, field: str, value: Any) -> QueryBuilder: ...
-
- @classmethod
- def where_not_in (cls, column: str, values: list[Any] | tuple) -> QueryBuilder: ...
-
- @classmethod
- def where_not_null (cls, field: str) -> QueryBuilder: ...
-
- @classmethod
- def set_connection_resolver (cls, resolver: DatabaseManager) -> None: ...
-
-
- class QueryBuilder (Generic[_TModel]):
- def first (self) -> _TModel | None: ...
-
- def get (self) -> list[_TModel]: ...
-
- @overload
- def where (self, field: str, operator: str, value: Any) -> QueryBuilder: ...
-
- @overload
- def where (self, field: str, value: Any) -> QueryBuilder: ...
-
- def where_null (self, field: str) -> QueryBuilder: ...
|