pjdev-postgres 4.2.2__tar.gz → 4.3.0__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.
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/PKG-INFO +1 -1
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/src/pjdev_postgres/__about__.py +1 -1
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/src/pjdev_postgres/postgres_service.py +20 -1
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/test_report_pjdev-postgres.txt +1 -1
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/tests/tests_for_history.py +1 -1
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/.gitignore +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/LICENSE.txt +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/README.md +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/pyproject.toml +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/src/pjdev_postgres/__init__.py +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/src/pjdev_postgres/concurrency_service.py +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/src/pjdev_postgres/model_validators.py +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/src/pjdev_postgres/models.py +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/src/pjdev_postgres/postgres_settings.py +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/test.sh +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/tests/__init__.py +0 -0
- {pjdev_postgres-4.2.2 → pjdev_postgres-4.3.0}/tests/utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pjdev-postgres
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3.0
|
|
4
4
|
Project-URL: Documentation, https://gitlab.purplejay.net/keystone/python/-/tree/main/keystone-postgres/README.md
|
|
5
5
|
Project-URL: Issues, https://gitlab.purplejay.net/keystone/python/-/issues
|
|
6
6
|
Project-URL: Source, https://gitlab.purplejay.net/keystone/python
|
|
@@ -68,12 +68,31 @@ def get_session() -> Generator[Session, Any, None]:
|
|
|
68
68
|
yield session
|
|
69
69
|
|
|
70
70
|
|
|
71
|
+
def create_new(
|
|
72
|
+
obj: T,
|
|
73
|
+
session: SQLModelSession,
|
|
74
|
+
commit: bool = True,
|
|
75
|
+
user_resolver: Callable[[], Tuple[Optional[str], str]] = lambda: ('anonymous_id', 'anonymous_name'),
|
|
76
|
+
) -> T:
|
|
77
|
+
new_obj = concurrency_service.validate_version(obj)
|
|
78
|
+
session.add(new_obj)
|
|
79
|
+
user_oid, username = user_resolver()
|
|
80
|
+
new_obj.created_by_id = user_oid
|
|
81
|
+
new_obj.created_by = username
|
|
82
|
+
|
|
83
|
+
if commit:
|
|
84
|
+
session.commit()
|
|
85
|
+
session.refresh(new_obj)
|
|
86
|
+
|
|
87
|
+
return new_obj
|
|
88
|
+
|
|
89
|
+
|
|
71
90
|
def save(
|
|
72
91
|
obj: T,
|
|
73
|
-
user_resolver: Callable[[], Tuple[Optional[str], str]],
|
|
74
92
|
session: SQLModelSession,
|
|
75
93
|
concurrency_token: Optional[UUID] = None,
|
|
76
94
|
commit: bool = True,
|
|
95
|
+
user_resolver: Callable[[], Tuple[Optional[str], str]] = lambda: ('anonymous_id', 'anonymous_name'),
|
|
77
96
|
) -> T:
|
|
78
97
|
updated_obj = concurrency_service.validate_version(obj, concurrency_token)
|
|
79
98
|
updated_obj.last_modified_datetime = datetime.now(timezone.utc)
|
|
@@ -7,4 +7,4 @@ collecting ... collected 1 item
|
|
|
7
7
|
|
|
8
8
|
tests/tests_for_history.py::test_history_item_is_created_and_saved PASSED [100%]
|
|
9
9
|
|
|
10
|
-
============================== 1 passed in 1.
|
|
10
|
+
============================== 1 passed in 1.05s ===============================
|
|
@@ -17,7 +17,7 @@ def test_history_item_is_created_and_saved():
|
|
|
17
17
|
obj = MockTable()
|
|
18
18
|
session.add(obj)
|
|
19
19
|
saved_obj = postgres_service.save(
|
|
20
|
-
obj, session=session
|
|
20
|
+
obj, session=session
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
assert saved_obj.last_modified_datetime is not None
|
|
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
|