add __getitem__

This commit is contained in:
Firepup Sixfifty 2025-01-21 14:08:29 -06:00
parent fccb27d020
commit 4740d378a1
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

View file

@ -74,6 +74,19 @@ class sql:
None""" None"""
self.__table = tableName 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: def get(self, name: str) -> Any:
"""# Function: sql.get """# Function: sql.get
Gets the value of a key Gets the value of a key