| Total Complexity | 3 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | 1 | import abc |
|
| 2 | |||
| 3 | 1 | from mysql.connector import MySQLConnection |
|
| 4 | |||
| 5 | |||
| 6 | 1 | class MySqlConnector: |
|
| 7 | """ |
||
| 8 | Interface for classes for connecting to a MySql instances. |
||
| 9 | """ |
||
| 10 | |||
| 11 | 1 | # ------------------------------------------------------------------------------------------------------------------ |
|
| 12 | 1 | @abc.abstractmethod |
|
| 13 | def connect(self) -> MySQLConnection: |
||
| 14 | """ |
||
| 15 | Connects to the MySql instance. |
||
| 16 | """ |
||
| 17 | raise NotImplementedError() |
||
| 18 | |||
| 19 | 1 | # ------------------------------------------------------------------------------------------------------------------ |
|
| 20 | 1 | @abc.abstractmethod |
|
| 21 | def disconnect(self) -> None: |
||
| 22 | """ |
||
| 23 | Disconnects from the MySql instance. |
||
| 24 | """ |
||
| 25 | raise NotImplementedError() |
||
| 26 | |||
| 27 | 1 | # ------------------------------------------------------------------------------------------------------------------ |
|
| 28 | 1 | @abc.abstractmethod |
|
| 29 | def is_alive(self) -> bool: |
||
| 30 | """ |
||
| 31 | Returns whether Python is (still) connected to a MySQL or MariaDB instance. |
||
| 32 | """ |
||
| 33 | raise NotImplementedError() |
||
| 34 | |||
| 36 |