This repository has been archived on 2022-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
sh_gismo/src/gismo_data/model/server.py

63 lines
1.5 KiB
Python

from typing import Optional
from cpl_core.database import TableABC
class Server(TableABC):
def __init__(self, dc_id: int, id=0):
self._server_id = id
self._discord_server_id = dc_id
@property
def server_id(self) -> int:
return self._server_id
@property
def discord_server_id(self) -> int:
return self._discord_server_id
@staticmethod
def get_create_string() -> str:
return str(f"""
CREATE TABLE IF NOT EXISTS `Servers` (
`ServerId` INT(30) NOT NULL AUTO_INCREMENT,
`DiscordServerId` INT(30) NOT NULL,
PRIMARY KEY(`ServerId`)
);
""")
@staticmethod
def get_select_all_string() -> str:
return str(f"""
SELECT * FROM `Servers`;
""")
@staticmethod
def get_select_by_id_string(id: int) -> str:
return str(f"""
SELECT * FROM `Servers`
WHERE `ServerId` = {id};
""")
@staticmethod
def get_select_by_discord_id_string(id: int) -> str:
return str(f"""
SELECT * FROM `Servers`
WHERE `DiscordServerId` = {id};
""")
@property
def insert_string(self) -> str:
return str(f"""
""")
@property
def udpate_string(self) -> str:
return str(f"""
""")
@property
def delete_string(self) -> str:
return str(f"""
""")