-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathinterfaces.py
39 lines (32 loc) · 947 Bytes
/
interfaces.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import abc
from typing import Dict, Iterable, Tuple
class DatabaseInterface(abc.ABC):
"""
Interface to abstract the iteraction with the database storing data used by the
tasks
"""
@abc.abstractmethod
def _commit_changes(self, command: str, data: Dict) -> None:
"""
Make a change in the database and commit it
"""
@abc.abstractmethod
def select(self, command: str) -> Iterable[Tuple]:
"""
Select entries from the database
"""
@abc.abstractmethod
def insert(self, command: str, data: Dict) -> None:
"""
Insert entries into the database
"""
@abc.abstractmethod
def update(self, command: str, data: Dict) -> None:
"""
Update entries from the database
"""
@abc.abstractmethod
def delete(self, command: str, data: Dict) -> None:
"""
Delete entries from the database
"""