[V3 Config] Implement a true clear method (#1344)

* Add clear methods to drivers

* Update config clear methods, add to Value

* Add test
This commit is contained in:
Will
2018-02-26 01:07:28 -05:00
committed by palmtree5
parent c1ac78eea4
commit e13de0950c
5 changed files with 68 additions and 19 deletions

View File

@@ -71,7 +71,7 @@ class Mongo(BaseDriver):
uuid, identifiers = identifiers[0], identifiers[1:]
return uuid, identifiers
async def get(self, *identifiers: Tuple[str]):
async def get(self, *identifiers: str):
await self._ensure_connected()
mongo_collection = self.get_collection()
@@ -104,6 +104,17 @@ class Mongo(BaseDriver):
upsert=True
)
async def clear(self, *identifiers: str):
await self._ensure_connected()
dot_identifiers = '.'.join(identifiers)
mongo_collection = self.get_collection()
await mongo_collection.update_one(
{'_id': self.unique_cog_identifier},
update={"$unset": {dot_identifiers: 1}}
)
def get_config_details():
host = input("Enter host address: ")