ns-orm 0.0.3__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ns_orm-0.0.3/src/ns_orm.egg-info → ns_orm-0.0.4}/PKG-INFO +1 -1
- {ns_orm-0.0.3 → ns_orm-0.0.4}/pyproject.toml +1 -1
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/manager.py +4 -4
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/model.py +5 -2
- {ns_orm-0.0.3 → ns_orm-0.0.4/src/ns_orm.egg-info}/PKG-INFO +1 -1
- {ns_orm-0.0.3 → ns_orm-0.0.4}/LICENSE +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/MANIFEST.in +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/README.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/async.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/database.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/index.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/migrations.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/models.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/queryset.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/relations.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/release.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/doc/schema.md +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/setup.cfg +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/__init__.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/cli.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/database.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/dialects.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/exceptions.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/expressions.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/fields.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/__init__.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/autodetector.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/executor.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/loader.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/migration.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/operations.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/state.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/migrations/writer.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/query.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/schema.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/typing.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm/utils.py +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm.egg-info/SOURCES.txt +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm.egg-info/dependency_links.txt +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm.egg-info/entry_points.txt +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm.egg-info/requires.txt +0 -0
- {ns_orm-0.0.3 → ns_orm-0.0.4}/src/ns_orm.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from typing import Any, Generic, TypeVar
|
|
4
|
+
from typing import Any, Generic, TypeVar, Union
|
|
5
5
|
|
|
6
6
|
from ns_orm.database import AsyncDatabase, Database, get_connection
|
|
7
7
|
from ns_orm.query import AsyncQuerySet, QuerySet
|
|
@@ -47,19 +47,19 @@ class Manager(Generic[TModel]):
|
|
|
47
47
|
async def aall(self) -> list[TModel]:
|
|
48
48
|
return await self.aqs().all()
|
|
49
49
|
|
|
50
|
-
def filter(self, **lookups: Any) ->
|
|
50
|
+
def filter(self, **lookups: Any) -> Union[QuerySet[TModel], AsyncQuerySet[TModel]]:
|
|
51
51
|
db = self._get_db()
|
|
52
52
|
if isinstance(db, AsyncDatabase):
|
|
53
53
|
return self.aqs().filter(**lookups)
|
|
54
54
|
return self.qs().filter(**lookups)
|
|
55
55
|
|
|
56
|
-
def exclude(self, **lookups: Any) ->
|
|
56
|
+
def exclude(self, **lookups: Any) -> Union[QuerySet[TModel], AsyncQuerySet[TModel]]:
|
|
57
57
|
db = self._get_db()
|
|
58
58
|
if isinstance(db, AsyncDatabase):
|
|
59
59
|
return self.aqs().exclude(**lookups)
|
|
60
60
|
return self.qs().exclude(**lookups)
|
|
61
61
|
|
|
62
|
-
def order_by(self, *fields: str) ->
|
|
62
|
+
def order_by(self, *fields: str) -> Union[QuerySet[TModel], AsyncQuerySet[TModel]]:
|
|
63
63
|
db = self._get_db()
|
|
64
64
|
if isinstance(db, AsyncDatabase):
|
|
65
65
|
return self.aqs().order_by(*fields)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
|
-
from typing import Any, ClassVar, Dict, Type, TypeVar
|
|
4
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Type, TypeVar
|
|
5
5
|
|
|
6
6
|
from pydantic import BaseModel
|
|
7
7
|
|
|
@@ -18,6 +18,9 @@ from ns_orm.utils import (
|
|
|
18
18
|
|
|
19
19
|
TModel = TypeVar("TModel", bound="Model")
|
|
20
20
|
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from ns_orm.manager import Manager
|
|
23
|
+
|
|
21
24
|
|
|
22
25
|
def _default_table_name(cls_name: str) -> str:
|
|
23
26
|
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", cls_name)
|
|
@@ -31,7 +34,7 @@ class Model(BaseModel):
|
|
|
31
34
|
|
|
32
35
|
_meta: ClassVar[ModelMetaInfo]
|
|
33
36
|
_registry: ClassVar[Dict[str, Type["Model"]]] = {}
|
|
34
|
-
objects: ClassVar[Any]
|
|
37
|
+
objects: ClassVar["Manager[Any]"]
|
|
35
38
|
|
|
36
39
|
@classmethod
|
|
37
40
|
def table_name(cls) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|