Base exception for Savedata errors.
No methods defined.
A table in the savedata: stores rows as dictionaries with column names as keys.
Supports primary key indexing for O(1) lookups and optional auto‑increment.
def __init__(self: Any, name: str, columns: List[str], primary_key: Optional[str] = None, auto_increment: bool = False) -> Any
def insert(self: Any, **kwargs: dict) -> int
def update(self: Any, where: Callable[[Dict], bool], **kwargs: dict) -> int
def update_where(self: Any, where: Callable[[Dict], bool], updates: Dict[str, Any]) -> int
def update_by_primary_key(self: Any, key: Any, **kwargs: dict) -> int
def updates(self: Any, updates_dict: Dict[Any, Union[Any, Dict[str, Any]]]) -> int
def upsert(self: Any, **kwargs: dict) -> int
def delete(self: Any, where: Callable[[Dict], bool]) -> int
def delete_by_primary_key(self: Any, key: Any) -> int
def select(self: Any, where: Optional[Callable[[Dict], bool]] = None, columns: Optional[List[str]] = None, order_by: Optional[Union[str, List[str]]] = None, order_desc: Union[bool, List[bool]] = False, search: Optional[str] = None, search_columns: Optional[List[str]] = None, search_mode: str = 'contains', case_sensitive: bool = False) -> List[Dict]
def find_one(self: Any, where: Optional[Callable[[Dict], bool]] = None) -> Optional[Dict]
def exists(self: Any, where: Callable[[Dict], bool]) -> bool
def count(self: Any, where: Optional[Callable[[Dict], bool]] = None) -> int
def get_next_id(self: Any) -> int
def _apply_search(self: Any, rows: List[Dict], term: str, search_columns: Optional[List[str]], mode: str, case_sensitive: bool) -> List[Dict]
def _sort_rows(self: Any, rows: List[Dict], order_by: Union[str, List[str]], order_desc: Union[bool, List[bool]]) -> List[Dict]
def get_by_primary_key(self: Any, key: Any) -> Optional[Dict]
def clear(self: Any) -> None
def query(self: Any) -> 'Query'
def _find_primary_key_for_idx(self: Any, idx: int) -> Any
def _rebuild_index(self: Any) -> None
def _update_next_id(self: Any) -> None
def __len__(self: Any) -> int
def __repr__(self: Any) -> str
Fluent query builder for Table.
def __init__(self: Any, table: Table) -> Any
def where(self: Any, predicate: Callable[[Dict], bool]) -> 'Query'
def order_by(self: Any, *columns: tuple) -> 'Query'
def search(self: Any, term: str, columns: Optional[List[str]] = None, mode: str = 'contains', case_sensitive: bool = False) -> 'Query'
def execute(self: Any, columns: Optional[List[str]] = None) -> List[Dict]
Main savedata manager. Holds multiple tables and provides load/save functionality.
Supports compression (zlib) and optional encryption via MachineEncryption.
File format:
- Magic bytes: "LUNASD" (7 bytes)
- Version: uint16
- Flags: uint8 (bit 0: compressed, bit 1: encrypted)
- Table count: uint32
- For each table:
- Name length (uint16) + name string (UTF-8)
- Column count (uint16)
- For each column: name length (uint16) + name string
- Primary key index (int16, -1 if none)
- Auto‑increment flag (uint8)
- Row count (uint32)
- For each row:
- For each column:
- Type tag (uint8): 0=None, 1=int, 2=float, 3=str, 4=bool, 5=bytes
- Data (variable)
MAGIC: Any = b'LUNASD'
VERSION: Any = 2
def __init__(self: Any, filepath: Optional[Union[str, Path]] = None, encryption_key: Optional[str] = None) -> Any
def create_table(self: Any, name: str, columns: List[str], primary_key: Optional[str] = None, auto_increment: bool = False) -> Table
def drop_table(self: Any, name: str) -> None
def table(self: Any, name: str) -> Optional[Table]
def clear(self: Any) -> None
def save(self: Any, filepath: Optional[Union[str, Path]] = None, encryption_key: Optional[str] = None, compress: bool = True) -> None
def load(self: Any, filepath: Optional[Union[str, Path]] = None, encryption_key: Optional[str] = None) -> None
def _serialize(self: Any) -> bytes
def _deserialize(self: Any, data: bytes) -> None
def _append_value(self: Any, parts: List[bytes], value: Any) -> None
def _read_value(self: Any, data: bytes, pos: int) -> Tuple[Any, int]
def _xor_encrypt(self: Any, data: bytes, key: str) -> bytes
def export_to_dict(self: Any) -> Dict[str, List[Dict]]
def import_from_dict(self: Any, data: Dict[str, List[Dict]]) -> None
def export_to_json(self: Any, filepath: Union[str, Path], indent: int = 2) -> None
def import_from_json(self: Any, filepath: Union[str, Path]) -> None
def migrate_to_plain(self: Any, output_path: Union[str, Path]) -> None
def migrate_from_plain(self: Any, input_path: Union[str, Path], new_key: Optional[str] = None) -> None
def __repr__(self: Any) -> str
def load_savedata(filepath: Union[str, Path], encryption_key: Optional[str] = None) -> Savedata
No documentation
def save_savedata(data: Savedata, filepath: Union[str, Path], encryption_key: Optional[str] = None, compress: bool = True) -> None
No documentation