Add save and load

This commit is contained in:
Andros Fenollosa 2022-11-10 19:00:57 +01:00
parent dbc13f5df7
commit c4176bdd77

View File

@ -1,4 +1,5 @@
FILE = "fiabledb.json" FILE = "fiabledb.json"
data = {}
def start(filename: str = "") -> str: def start(filename: str = "") -> str:
@ -12,6 +13,27 @@ def start(filename: str = "") -> str:
return file_name return file_name
def save(filename: str = "", data: list[str, list[int, int, dict]] = {}) -> bool:
"""Save the database
Args:
filename (str, optional): The file to save to. Defaults to "".
data (list[str, list[int, int, dict]], optional): The data to save. Defaults to {}.
Returns:
bool: True if the data was saved, False otherwise
"""
pass
def load(filename: str = "") -> list[str, list[int, int, dict]]:
"""Load the database
Args:
filename (str, optional): The file to load from. Defaults to "".
Returns:
list[str, list[int, int, dict]]: The data loaded
"""
pass
def add( def add(
new_data: dict | list, table: str = "" new_data: dict | list, table: str = ""
) -> dict[int, int, dict] | list[dict[int, int, dict]]: ) -> dict[int, int, dict] | list[dict[int, int, dict]]: