kinit/kinit-api/core/mongo/database_manage.py
ktianc afa9110771 1. 更新:kinit-api:core/crud.py keys 查询多外键时需添加onclause属性
2. 修复:kinit-admin: form属性设置了ifshow无法设置值问题修复
3. 修复:kinit-admin:表格字段设置缓存问题修复
2023-02-08 11:11:28 +08:00

48 lines
1.0 KiB
Python

from abc import abstractmethod
from typing import Any
class DatabaseManage:
"""
This class is meant to be extended from
./mongo_manage.py which will be the actual connection to mongodb.
"""
@property
def client(self):
raise NotImplementedError
@property
def db(self):
raise NotImplementedError
# database connect and close connections
@abstractmethod
async def connect_to_database(self, path: str, db_name: str):
pass
@abstractmethod
async def close_database_connection(self):
pass
@abstractmethod
async def create_data(self, collection: str, data: dict):
pass
@abstractmethod
async def get_datas(
self,
collection: str,
page: int = 1,
limit: int = 10,
v_schema: Any = None,
v_order: str = None,
v_order_field: str = None,
**kwargs
):
pass
@abstractmethod
async def get_count(self, collection: str, **kwargs) -> int:
pass