| 1 |
from abc import abstractmethod |
| 2 |
|
| 3 |
from pymongo.asynchronous.collection import AsyncCollection |
| 4 |
|
| 5 |
from beanie.odm.settings.base import ItemSettings |
| 6 |
|
| 7 |
|
| 8 |
class OtherGettersInterface: |
| 9 |
@classmethod |
| 10 |
@abstractmethod |
| 11 |
def get_settings(cls) -> ItemSettings: |
| 12 |
pass |
| 13 |
|
| 14 |
@classmethod |
| 15 |
def get_pymongo_collection(cls) -> AsyncCollection: |
| 16 |
return cls.get_settings().pymongo_collection |
| 17 |
|
| 18 |
@classmethod |
| 19 |
def get_collection_name(cls) -> str: |
| 20 |
return cls.get_settings().name # type: ignore |
| 21 |
|
| 22 |
@classmethod |
| 23 |
def get_bson_encoders(cls): |
| 24 |
return cls.get_settings().bson_encoders |
| 25 |
|
| 26 |
@classmethod |
| 27 |
def get_link_fields(cls): |
| 28 |
return None |