add __getitem__
This commit is contained in:
parent
fccb27d020
commit
4740d378a1
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue