Define split JSON and object repository ABCs, promote adapter methods to public CRUD, add example domain repositories, modernize interface stubs, and make the package installable for tests. Co-authored-by: Cursor <[email protected]>
28 lines
690 B
Python
28 lines
690 B
Python
"""Definition of JsonRepositoryInterface abstract base class."""
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
|
class JsonRepositoryInterface(ABC):
|
|
"""Interface that defines JSON document CRUD methods."""
|
|
|
|
@abstractmethod
|
|
def get(self, key: str) -> dict | None:
|
|
"""Get a JSON object by key."""
|
|
...
|
|
|
|
@abstractmethod
|
|
def set(self, key: str, data: dict) -> None:
|
|
"""Set a JSON object by key."""
|
|
...
|
|
|
|
@abstractmethod
|
|
def delete(self, key: str) -> None:
|
|
"""Delete a JSON object by key."""
|
|
...
|
|
|
|
@abstractmethod
|
|
def list_keys(self, pattern: str) -> list[str]:
|
|
"""List keys matching a glob pattern."""
|
|
...
|