From 4740d378a1ecacefacef4de4e272136f861f5f6d Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Tue, 21 Jan 2025 14:08:29 -0600 Subject: [PATCH] add __getitem__ --- package/src/fpsql/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/package/src/fpsql/__init__.py b/package/src/fpsql/__init__.py index c49c698..a7e8938 100644 --- a/package/src/fpsql/__init__.py +++ b/package/src/fpsql/__init__.py @@ -74,6 +74,19 @@ class sql: None""" self.__table = tableName + def __getitem__(self, name: str) -> Any: + """# Function: sql.__getitem__ + Gets the value of a key + # Inputs: + name: str - The name of the key to retrieve + + # Returns: + Any - If the key exists, return it's value (casted), otherwise, return `None` + + # Raises: + AttributeError - If the table is unset""" + return get(name) + def get(self, name: str) -> Any: """# Function: sql.get Gets the value of a key