Use simpler, better name for wrapper function
This commit is contained in:
parent
94f9261350
commit
0ac4b2f9b3
1 changed files with 4 additions and 4 deletions
|
@ -113,7 +113,7 @@ class Database():
|
||||||
def get(self, table, values: dict=dict()):
|
def get(self, table, values: dict=dict()):
|
||||||
return self.query(table, values).fetchone()
|
return self.query(table, values).fetchone()
|
||||||
|
|
||||||
def _sqlite3_function(self, table, fn: str, column: str, values: dict=dict()) -> int:
|
def _call(self, table, fn: str, column: str, values: dict=dict()) -> int:
|
||||||
sql = f"select {fn}({column}) as ret from {table.name}"
|
sql = f"select {fn}({column}) as ret from {table.name}"
|
||||||
|
|
||||||
if len(values) > 0:
|
if len(values) > 0:
|
||||||
|
@ -125,10 +125,10 @@ class Database():
|
||||||
return row[0] if row is not None else None
|
return row[0] if row is not None else None
|
||||||
|
|
||||||
def min(self, table, column: str, values: dict=dict()) -> int:
|
def min(self, table, column: str, values: dict=dict()) -> int:
|
||||||
return self._sqlite3_function(table, 'min', column, values)
|
return self._call(table, 'min', column, values)
|
||||||
|
|
||||||
def max(self, table, column: str, values: dict=dict()) -> int:
|
def max(self, table, column: str, values: dict=dict()) -> int:
|
||||||
return self._sqlite3_function(table, 'max', column, values)
|
return self._call(table, 'max', column, values)
|
||||||
|
|
||||||
def count(self, table, values: dict=dict()) -> int:
|
def count(self, table, values: dict=dict()) -> int:
|
||||||
return self._sqlite3_function(table, 'count', table.key, values)
|
return self._call(table, 'count', table.key, values)
|
||||||
|
|
Loading…
Add table
Reference in a new issue