maleo-database 0.0.1__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.
Files changed (37) hide show
  1. maleo_database-0.0.1/LICENSE +57 -0
  2. maleo_database-0.0.1/PKG-INFO +93 -0
  3. maleo_database-0.0.1/README.md +29 -0
  4. maleo_database-0.0.1/maleo_database.egg-info/PKG-INFO +93 -0
  5. maleo_database-0.0.1/maleo_database.egg-info/SOURCES.txt +35 -0
  6. maleo_database-0.0.1/maleo_database.egg-info/dependency_links.txt +1 -0
  7. maleo_database-0.0.1/maleo_database.egg-info/requires.txt +53 -0
  8. maleo_database-0.0.1/maleo_database.egg-info/top_level.txt +1 -0
  9. maleo_database-0.0.1/pyproject.toml +101 -0
  10. maleo_database-0.0.1/setup.cfg +4 -0
  11. maleo_database-0.0.1/src/__init__.py +0 -0
  12. maleo_database-0.0.1/src/config/__init__.py +105 -0
  13. maleo_database-0.0.1/src/config/additional.py +36 -0
  14. maleo_database-0.0.1/src/config/connection.py +544 -0
  15. maleo_database-0.0.1/src/config/identifier.py +12 -0
  16. maleo_database-0.0.1/src/config/pooling.py +255 -0
  17. maleo_database-0.0.1/src/enums.py +85 -0
  18. maleo_database-0.0.1/src/managers/__init__.py +0 -0
  19. maleo_database-0.0.1/src/managers/clients/__init__.py +0 -0
  20. maleo_database-0.0.1/src/managers/clients/elasticsearch.py +66 -0
  21. maleo_database-0.0.1/src/managers/clients/mongodb.py +53 -0
  22. maleo_database-0.0.1/src/managers/clients/redis.py +57 -0
  23. maleo_database-0.0.1/src/managers/engines/__init__.py +0 -0
  24. maleo_database-0.0.1/src/managers/engines/mysql.py +56 -0
  25. maleo_database-0.0.1/src/managers/engines/postgresql.py +58 -0
  26. maleo_database-0.0.1/src/managers/engines/sqlite.py +55 -0
  27. maleo_database-0.0.1/src/managers/engines/sqlserver.py +63 -0
  28. maleo_database-0.0.1/src/managers/session.py +123 -0
  29. maleo_database-0.0.1/src/orm/__init__.py +0 -0
  30. maleo_database-0.0.1/src/orm/base.py +7 -0
  31. maleo_database-0.0.1/src/orm/models/__init__.py +0 -0
  32. maleo_database-0.0.1/src/orm/models/mixins/__init__.py +0 -0
  33. maleo_database-0.0.1/src/orm/models/mixins/identifier.py +11 -0
  34. maleo_database-0.0.1/src/orm/models/mixins/status.py +12 -0
  35. maleo_database-0.0.1/src/orm/models/mixins/timestamp.py +65 -0
  36. maleo_database-0.0.1/src/orm/models/table.py +17 -0
  37. maleo_database-0.0.1/src/orm/queries.py +234 -0
@@ -0,0 +1,57 @@
1
+ # Proprietary Software License
2
+
3
+ **Copyright (c) 2025 Agra Bima Yuda / Nexmedis**
4
+
5
+ ## License Grant
6
+
7
+ This software and associated documentation files (the "Software") are proprietary and confidential to Agra Bima Yuda and/or Nexmedis ("Licensor"). All rights reserved.
8
+
9
+ ## Restrictions
10
+
11
+ **NO PERMISSION** is granted to any person to:
12
+
13
+ 1. **Use** the Software for any purpose without explicit written permission from the Licensor
14
+ 2. **Copy, modify, merge, publish, distribute, sublicense, or sell** copies of the Software
15
+ 3. **Reverse engineer, decompile, or disassemble** the Software
16
+ 4. **Create derivative works** based upon the Software
17
+ 5. **Remove or alter** any proprietary notices, labels, or marks on the Software
18
+
19
+ ## Permitted Use
20
+
21
+ Use of this Software is permitted only under the following conditions:
22
+
23
+ 1. **Authorized Users**: Only individuals or entities explicitly authorized by the Licensor in writing
24
+ 2. **Internal Use Only**: The Software may only be used for internal business purposes of the authorized entity
25
+ 3. **No Redistribution**: The Software may not be shared, distributed, or made available to any third party
26
+
27
+ ## Ownership
28
+
29
+ The Software is and remains the exclusive property of the Licensor. This license does not grant any ownership rights in the Software.
30
+
31
+ ## Confidentiality
32
+
33
+ The Software contains proprietary and confidential information. Recipients agree to:
34
+
35
+ 1. Maintain the confidentiality of the Software
36
+ 2. Use the same degree of care to protect the Software as they use for their own confidential information, but no less than reasonable care
37
+ 3. Not disclose the Software to any third party without prior written consent
38
+
39
+ ## Termination
40
+
41
+ This license is effective until terminated. The Licensor may terminate this license at any time without notice. Upon termination, all rights granted herein cease immediately, and the recipient must destroy all copies of the Software.
42
+
43
+ ## Disclaimer of Warranty
44
+
45
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46
+
47
+ ## Limitation of Liability
48
+
49
+ IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50
+
51
+ ## Governing Law
52
+
53
+ This license shall be governed by and construed in accordance with the laws of Indonesia, without regard to its conflict of law provisions.
54
+
55
+ ---
56
+
57
+ For licensing inquiries, contact: agra@nexmedis.com
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: maleo-database
3
+ Version: 0.0.1
4
+ Summary: Database package for MaleoSuite
5
+ Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
+ License: Proprietary
7
+ Requires-Python: >=3.12
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: aioredis>=2.0.1
11
+ Requires-Dist: annotated-types>=0.7.0
12
+ Requires-Dist: anyio>=4.10.0
13
+ Requires-Dist: async-timeout>=5.0.1
14
+ Requires-Dist: black>=25.1.0
15
+ Requires-Dist: cachetools>=5.5.2
16
+ Requires-Dist: certifi>=2025.8.3
17
+ Requires-Dist: cffi>=1.17.1
18
+ Requires-Dist: cfgv>=3.4.0
19
+ Requires-Dist: click>=8.2.1
20
+ Requires-Dist: cryptography>=45.0.6
21
+ Requires-Dist: distlib>=0.4.0
22
+ Requires-Dist: dnspython>=2.7.0
23
+ Requires-Dist: elastic-transport>=9.1.0
24
+ Requires-Dist: elasticsearch>=9.1.0
25
+ Requires-Dist: fastapi>=0.116.1
26
+ Requires-Dist: filelock>=3.19.1
27
+ Requires-Dist: google-auth>=2.40.3
28
+ Requires-Dist: greenlet>=3.2.4
29
+ Requires-Dist: identify>=2.6.13
30
+ Requires-Dist: idna>=3.10
31
+ Requires-Dist: maleo-constants>=0.0.2
32
+ Requires-Dist: maleo-enums>=0.0.2
33
+ Requires-Dist: maleo-mixins>=0.0.2
34
+ Requires-Dist: maleo-types-base>=0.0.2
35
+ Requires-Dist: maleo-types-enums>=0.0.2
36
+ Requires-Dist: maleo-utils>=0.0.3
37
+ Requires-Dist: motor>=3.7.1
38
+ Requires-Dist: mypy_extensions>=1.1.0
39
+ Requires-Dist: nodeenv>=1.9.1
40
+ Requires-Dist: packaging>=25.0
41
+ Requires-Dist: pathspec>=0.12.1
42
+ Requires-Dist: platformdirs>=4.4.0
43
+ Requires-Dist: pre_commit>=4.3.0
44
+ Requires-Dist: pyasn1>=0.6.1
45
+ Requires-Dist: pyasn1_modules>=0.4.2
46
+ Requires-Dist: pycparser>=2.22
47
+ Requires-Dist: pycryptodome>=3.23.0
48
+ Requires-Dist: pydantic>=2.11.7
49
+ Requires-Dist: pydantic_core>=2.33.2
50
+ Requires-Dist: pymongo>=4.14.1
51
+ Requires-Dist: python-dateutil>=2.9.0.post0
52
+ Requires-Dist: PyYAML>=6.0.2
53
+ Requires-Dist: redis>=6.4.0
54
+ Requires-Dist: rsa>=4.9.1
55
+ Requires-Dist: six>=1.17.0
56
+ Requires-Dist: sniffio>=1.3.1
57
+ Requires-Dist: SQLAlchemy>=2.0.43
58
+ Requires-Dist: starlette>=0.47.3
59
+ Requires-Dist: typing-inspection>=0.4.1
60
+ Requires-Dist: typing_extensions>=4.15.0
61
+ Requires-Dist: urllib3>=2.5.0
62
+ Requires-Dist: virtualenv>=20.34.0
63
+ Dynamic: license-file
64
+
65
+ # README #
66
+
67
+ This README would normally document whatever steps are necessary to get your application up and running.
68
+
69
+ ### What is this repository for? ###
70
+
71
+ * Quick summary
72
+ * Version
73
+ * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
74
+
75
+ ### How do I get set up? ###
76
+
77
+ * Summary of set up
78
+ * Configuration
79
+ * Dependencies
80
+ * Database configuration
81
+ * How to run tests
82
+ * Deployment instructions
83
+
84
+ ### Contribution guidelines ###
85
+
86
+ * Writing tests
87
+ * Code review
88
+ * Other guidelines
89
+
90
+ ### Who do I talk to? ###
91
+
92
+ * Repo owner or admin
93
+ * Other community or team contact
@@ -0,0 +1,29 @@
1
+ # README #
2
+
3
+ This README would normally document whatever steps are necessary to get your application up and running.
4
+
5
+ ### What is this repository for? ###
6
+
7
+ * Quick summary
8
+ * Version
9
+ * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
+
11
+ ### How do I get set up? ###
12
+
13
+ * Summary of set up
14
+ * Configuration
15
+ * Dependencies
16
+ * Database configuration
17
+ * How to run tests
18
+ * Deployment instructions
19
+
20
+ ### Contribution guidelines ###
21
+
22
+ * Writing tests
23
+ * Code review
24
+ * Other guidelines
25
+
26
+ ### Who do I talk to? ###
27
+
28
+ * Repo owner or admin
29
+ * Other community or team contact
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: maleo-database
3
+ Version: 0.0.1
4
+ Summary: Database package for MaleoSuite
5
+ Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
+ License: Proprietary
7
+ Requires-Python: >=3.12
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: aioredis>=2.0.1
11
+ Requires-Dist: annotated-types>=0.7.0
12
+ Requires-Dist: anyio>=4.10.0
13
+ Requires-Dist: async-timeout>=5.0.1
14
+ Requires-Dist: black>=25.1.0
15
+ Requires-Dist: cachetools>=5.5.2
16
+ Requires-Dist: certifi>=2025.8.3
17
+ Requires-Dist: cffi>=1.17.1
18
+ Requires-Dist: cfgv>=3.4.0
19
+ Requires-Dist: click>=8.2.1
20
+ Requires-Dist: cryptography>=45.0.6
21
+ Requires-Dist: distlib>=0.4.0
22
+ Requires-Dist: dnspython>=2.7.0
23
+ Requires-Dist: elastic-transport>=9.1.0
24
+ Requires-Dist: elasticsearch>=9.1.0
25
+ Requires-Dist: fastapi>=0.116.1
26
+ Requires-Dist: filelock>=3.19.1
27
+ Requires-Dist: google-auth>=2.40.3
28
+ Requires-Dist: greenlet>=3.2.4
29
+ Requires-Dist: identify>=2.6.13
30
+ Requires-Dist: idna>=3.10
31
+ Requires-Dist: maleo-constants>=0.0.2
32
+ Requires-Dist: maleo-enums>=0.0.2
33
+ Requires-Dist: maleo-mixins>=0.0.2
34
+ Requires-Dist: maleo-types-base>=0.0.2
35
+ Requires-Dist: maleo-types-enums>=0.0.2
36
+ Requires-Dist: maleo-utils>=0.0.3
37
+ Requires-Dist: motor>=3.7.1
38
+ Requires-Dist: mypy_extensions>=1.1.0
39
+ Requires-Dist: nodeenv>=1.9.1
40
+ Requires-Dist: packaging>=25.0
41
+ Requires-Dist: pathspec>=0.12.1
42
+ Requires-Dist: platformdirs>=4.4.0
43
+ Requires-Dist: pre_commit>=4.3.0
44
+ Requires-Dist: pyasn1>=0.6.1
45
+ Requires-Dist: pyasn1_modules>=0.4.2
46
+ Requires-Dist: pycparser>=2.22
47
+ Requires-Dist: pycryptodome>=3.23.0
48
+ Requires-Dist: pydantic>=2.11.7
49
+ Requires-Dist: pydantic_core>=2.33.2
50
+ Requires-Dist: pymongo>=4.14.1
51
+ Requires-Dist: python-dateutil>=2.9.0.post0
52
+ Requires-Dist: PyYAML>=6.0.2
53
+ Requires-Dist: redis>=6.4.0
54
+ Requires-Dist: rsa>=4.9.1
55
+ Requires-Dist: six>=1.17.0
56
+ Requires-Dist: sniffio>=1.3.1
57
+ Requires-Dist: SQLAlchemy>=2.0.43
58
+ Requires-Dist: starlette>=0.47.3
59
+ Requires-Dist: typing-inspection>=0.4.1
60
+ Requires-Dist: typing_extensions>=4.15.0
61
+ Requires-Dist: urllib3>=2.5.0
62
+ Requires-Dist: virtualenv>=20.34.0
63
+ Dynamic: license-file
64
+
65
+ # README #
66
+
67
+ This README would normally document whatever steps are necessary to get your application up and running.
68
+
69
+ ### What is this repository for? ###
70
+
71
+ * Quick summary
72
+ * Version
73
+ * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
74
+
75
+ ### How do I get set up? ###
76
+
77
+ * Summary of set up
78
+ * Configuration
79
+ * Dependencies
80
+ * Database configuration
81
+ * How to run tests
82
+ * Deployment instructions
83
+
84
+ ### Contribution guidelines ###
85
+
86
+ * Writing tests
87
+ * Code review
88
+ * Other guidelines
89
+
90
+ ### Who do I talk to? ###
91
+
92
+ * Repo owner or admin
93
+ * Other community or team contact
@@ -0,0 +1,35 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ maleo_database.egg-info/PKG-INFO
5
+ maleo_database.egg-info/SOURCES.txt
6
+ maleo_database.egg-info/dependency_links.txt
7
+ maleo_database.egg-info/requires.txt
8
+ maleo_database.egg-info/top_level.txt
9
+ src/__init__.py
10
+ src/enums.py
11
+ src/config/__init__.py
12
+ src/config/additional.py
13
+ src/config/connection.py
14
+ src/config/identifier.py
15
+ src/config/pooling.py
16
+ src/managers/__init__.py
17
+ src/managers/session.py
18
+ src/managers/clients/__init__.py
19
+ src/managers/clients/elasticsearch.py
20
+ src/managers/clients/mongodb.py
21
+ src/managers/clients/redis.py
22
+ src/managers/engines/__init__.py
23
+ src/managers/engines/mysql.py
24
+ src/managers/engines/postgresql.py
25
+ src/managers/engines/sqlite.py
26
+ src/managers/engines/sqlserver.py
27
+ src/orm/__init__.py
28
+ src/orm/base.py
29
+ src/orm/queries.py
30
+ src/orm/models/__init__.py
31
+ src/orm/models/table.py
32
+ src/orm/models/mixins/__init__.py
33
+ src/orm/models/mixins/identifier.py
34
+ src/orm/models/mixins/status.py
35
+ src/orm/models/mixins/timestamp.py
@@ -0,0 +1,53 @@
1
+ aioredis>=2.0.1
2
+ annotated-types>=0.7.0
3
+ anyio>=4.10.0
4
+ async-timeout>=5.0.1
5
+ black>=25.1.0
6
+ cachetools>=5.5.2
7
+ certifi>=2025.8.3
8
+ cffi>=1.17.1
9
+ cfgv>=3.4.0
10
+ click>=8.2.1
11
+ cryptography>=45.0.6
12
+ distlib>=0.4.0
13
+ dnspython>=2.7.0
14
+ elastic-transport>=9.1.0
15
+ elasticsearch>=9.1.0
16
+ fastapi>=0.116.1
17
+ filelock>=3.19.1
18
+ google-auth>=2.40.3
19
+ greenlet>=3.2.4
20
+ identify>=2.6.13
21
+ idna>=3.10
22
+ maleo-constants>=0.0.2
23
+ maleo-enums>=0.0.2
24
+ maleo-mixins>=0.0.2
25
+ maleo-types-base>=0.0.2
26
+ maleo-types-enums>=0.0.2
27
+ maleo-utils>=0.0.3
28
+ motor>=3.7.1
29
+ mypy_extensions>=1.1.0
30
+ nodeenv>=1.9.1
31
+ packaging>=25.0
32
+ pathspec>=0.12.1
33
+ platformdirs>=4.4.0
34
+ pre_commit>=4.3.0
35
+ pyasn1>=0.6.1
36
+ pyasn1_modules>=0.4.2
37
+ pycparser>=2.22
38
+ pycryptodome>=3.23.0
39
+ pydantic>=2.11.7
40
+ pydantic_core>=2.33.2
41
+ pymongo>=4.14.1
42
+ python-dateutil>=2.9.0.post0
43
+ PyYAML>=6.0.2
44
+ redis>=6.4.0
45
+ rsa>=4.9.1
46
+ six>=1.17.0
47
+ sniffio>=1.3.1
48
+ SQLAlchemy>=2.0.43
49
+ starlette>=0.47.3
50
+ typing-inspection>=0.4.1
51
+ typing_extensions>=4.15.0
52
+ urllib3>=2.5.0
53
+ virtualenv>=20.34.0
@@ -0,0 +1,101 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "maleo-database"
7
+ version = "0.0.1"
8
+ description = "Database package for MaleoSuite"
9
+ authors = [
10
+ { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }
11
+ ]
12
+ license = { text = "Proprietary" }
13
+ readme = "README.md"
14
+ requires-python = ">=3.12"
15
+ dependencies = [
16
+ "aioredis>=2.0.1",
17
+ "annotated-types>=0.7.0",
18
+ "anyio>=4.10.0",
19
+ "async-timeout>=5.0.1",
20
+ "black>=25.1.0",
21
+ "cachetools>=5.5.2",
22
+ "certifi>=2025.8.3",
23
+ "cffi>=1.17.1",
24
+ "cfgv>=3.4.0",
25
+ "click>=8.2.1",
26
+ "cryptography>=45.0.6",
27
+ "distlib>=0.4.0",
28
+ "dnspython>=2.7.0",
29
+ "elastic-transport>=9.1.0",
30
+ "elasticsearch>=9.1.0",
31
+ "fastapi>=0.116.1",
32
+ "filelock>=3.19.1",
33
+ "google-auth>=2.40.3",
34
+ "greenlet>=3.2.4",
35
+ "identify>=2.6.13",
36
+ "idna>=3.10",
37
+ "maleo-constants>=0.0.2",
38
+ "maleo-enums>=0.0.2",
39
+ "maleo-mixins>=0.0.2",
40
+ "maleo-types-base>=0.0.2",
41
+ "maleo-types-enums>=0.0.2",
42
+ "maleo-utils>=0.0.3",
43
+ "motor>=3.7.1",
44
+ "mypy_extensions>=1.1.0",
45
+ "nodeenv>=1.9.1",
46
+ "packaging>=25.0",
47
+ "pathspec>=0.12.1",
48
+ "platformdirs>=4.4.0",
49
+ "pre_commit>=4.3.0",
50
+ "pyasn1>=0.6.1",
51
+ "pyasn1_modules>=0.4.2",
52
+ "pycparser>=2.22",
53
+ "pycryptodome>=3.23.0",
54
+ "pydantic>=2.11.7",
55
+ "pydantic_core>=2.33.2",
56
+ "pymongo>=4.14.1",
57
+ "python-dateutil>=2.9.0.post0",
58
+ "PyYAML>=6.0.2",
59
+ "redis>=6.4.0",
60
+ "rsa>=4.9.1",
61
+ "six>=1.17.0",
62
+ "sniffio>=1.3.1",
63
+ "SQLAlchemy>=2.0.43",
64
+ "starlette>=0.47.3",
65
+ "typing-inspection>=0.4.1",
66
+ "typing_extensions>=4.15.0",
67
+ "urllib3>=2.5.0",
68
+ "virtualenv>=20.34.0",
69
+ ]
70
+
71
+ [tool.setuptools]
72
+ packages = [
73
+ "maleo.database",
74
+ "maleo.database.config",
75
+ "maleo.database.managers",
76
+ "maleo.database.managers.clients",
77
+ "maleo.database.managers.engines",
78
+ "maleo.database.orm",
79
+ "maleo.database.orm.models",
80
+ "maleo.database.orm.models.mixins",
81
+ ]
82
+
83
+ [tool.setuptools.package-data]
84
+ "maleo.database" = ["*.json", "*.yaml"]
85
+ "maleo.database.config" = ["*.json", "*.yaml"]
86
+ "maleo.database.managers" = ["*.json", "*.yaml"]
87
+ "maleo.database.managers.clients" = ["*.json", "*.yaml"]
88
+ "maleo.database.managers.engines" = ["*.json", "*.yaml"]
89
+ "maleo.database.orm" = ["*.json", "*.yaml"]
90
+ "maleo.database.orm.models" = ["*.json", "*.yaml"]
91
+ "maleo.database.orm.models.mixins" = ["*.json", "*.yaml"]
92
+
93
+ [tool.setuptools.package-dir]
94
+ "maleo.database" = "src"
95
+ "maleo.database.config" = "src/config"
96
+ "maleo.database.managers" = "src/managers"
97
+ "maleo.database.managers.clients" = "src/managers/clients"
98
+ "maleo.database.managers.engines" = "src/managers/engines"
99
+ "maleo.database.orm" = "src/orm"
100
+ "maleo.database.orm.models" = "src/orm/models"
101
+ "maleo.database.orm.models.mixins" = "src/orm/models/mixins"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,105 @@
1
+ from pydantic import BaseModel, Field
2
+ from typing import Generic
3
+ from .additional import AdditionalConfigT, RedisAdditionalConfig
4
+ from .connection import (
5
+ ConnectionConfigT,
6
+ PostgreSQLConnectionConfig,
7
+ MySQLConnectionConfig,
8
+ SQLiteConnectionConfig,
9
+ SQLServerConnectionConfig,
10
+ MongoDBConnectionConfig,
11
+ RedisConnectionConfig,
12
+ ElasticsearchConnectionConfig,
13
+ )
14
+ from .identifier import DatabaseIdentifierConfig
15
+ from .pooling import (
16
+ PoolingConfigT,
17
+ PostgreSQLPoolingConfig,
18
+ MySQLPoolingConfig,
19
+ SQLitePoolingConfig,
20
+ SQLServerPoolingConfig,
21
+ MongoDBPoolingConfig,
22
+ RedisPoolingConfig,
23
+ ElasticsearchPoolingConfig,
24
+ )
25
+
26
+
27
+ class BaseDatabaseConfig(
28
+ BaseModel, Generic[ConnectionConfigT, PoolingConfigT, AdditionalConfigT]
29
+ ):
30
+ """Base configuration for database."""
31
+
32
+ identifier: DatabaseIdentifierConfig = Field(..., description="Identifier config")
33
+ connection: ConnectionConfigT = Field(..., description="Connection config")
34
+ pooling: PoolingConfigT = Field(..., description="Pooling config")
35
+ additional: AdditionalConfigT = Field(..., description="Additional config")
36
+
37
+
38
+ class PostgreSQLDatabaseConfig(
39
+ BaseDatabaseConfig[
40
+ PostgreSQLConnectionConfig,
41
+ PostgreSQLPoolingConfig,
42
+ None,
43
+ ]
44
+ ):
45
+ additional: None = None
46
+
47
+
48
+ class MySQLDatabaseConfig(
49
+ BaseDatabaseConfig[
50
+ MySQLConnectionConfig,
51
+ MySQLPoolingConfig,
52
+ None,
53
+ ]
54
+ ):
55
+ additional: None = None
56
+
57
+
58
+ class SQLiteDatabaseConfig(
59
+ BaseDatabaseConfig[
60
+ SQLiteConnectionConfig,
61
+ SQLitePoolingConfig,
62
+ None,
63
+ ]
64
+ ):
65
+ additional: None = None
66
+
67
+
68
+ class SQLServerDatabaseConfig(
69
+ BaseDatabaseConfig[
70
+ SQLServerConnectionConfig,
71
+ SQLServerPoolingConfig,
72
+ None,
73
+ ]
74
+ ):
75
+ additional: None = None
76
+
77
+
78
+ class MongoDBDatabaseConfig(
79
+ BaseDatabaseConfig[
80
+ MongoDBConnectionConfig,
81
+ MongoDBPoolingConfig,
82
+ None,
83
+ ]
84
+ ):
85
+ additional: None = None
86
+
87
+
88
+ class RedisDatabaseConfig(
89
+ BaseDatabaseConfig[
90
+ RedisConnectionConfig,
91
+ RedisPoolingConfig,
92
+ RedisAdditionalConfig,
93
+ ]
94
+ ):
95
+ additional: RedisAdditionalConfig = Field(..., description="Additional config")
96
+
97
+
98
+ class ElasticsearchDatabaseConfig(
99
+ BaseDatabaseConfig[
100
+ ElasticsearchConnectionConfig,
101
+ ElasticsearchPoolingConfig,
102
+ None,
103
+ ]
104
+ ):
105
+ additional: None = None
@@ -0,0 +1,36 @@
1
+ from pydantic import BaseModel, Field
2
+ from typing import Optional, TypeVar, Union
3
+ from maleo.enums.cache import Origin, Layer
4
+ from maleo.enums.expiration import Expiration
5
+ from maleo.types.base.string import OptionalString
6
+
7
+
8
+ class RedisCacheNamespaces(BaseModel):
9
+ base: str = Field(..., description="Base Redis's namespace")
10
+
11
+ def create(
12
+ self,
13
+ *ext: str,
14
+ origin: Origin,
15
+ layer: Layer,
16
+ base_override: OptionalString = None,
17
+ ) -> str:
18
+ return ":".join(
19
+ [self.base if base_override is None else base_override, origin, layer, *ext]
20
+ )
21
+
22
+
23
+ class BaseAdditionalConfig(BaseModel):
24
+ """Base additional configuration class for database."""
25
+
26
+
27
+ AdditionalConfigT = TypeVar("AdditionalConfigT", bound=Optional[BaseAdditionalConfig])
28
+
29
+
30
+ class RedisAdditionalConfig(BaseAdditionalConfig):
31
+ ttl: Union[float, int] = Field(
32
+ Expiration.EXP_15MN.value, description="Time to live"
33
+ )
34
+ namespaces: RedisCacheNamespaces = Field(
35
+ ..., description="Redis cache's namepsaces"
36
+ )