diff --git a/src/app/app.py b/src/app/app.py index 0efe743..d2693e1 100644 --- a/src/app/app.py +++ b/src/app/app.py @@ -172,16 +172,24 @@ class WebDbApplication(BaseApplication): return web.json_response(response) async def set(self, key, value): + return self.sset(key,value) + + def sset(self, key, value): value = json.dumps(value, default=str) return self.db["kv"].upsert({"key": key, "value": value}, ["key"]) - async def get(self, key, default=None): + async def get(key,default=None): + return self.sget(key, default) + + def sget(self, key, default=None): record = self.db["kv"].find_one(key=key) if record: result = record.get("value", "null") return result == "null" and default or json.loads(result) return default + + async def insert(self, table_name, data): return self.db[table_name].insert(data)