Created
March 2, 2020 22:34
-
-
Save kenvontucky/1100684a10ed344b91f1ccf00d41a1f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dynamo.base import DynamoBase | |
from samples.domain.schema import TABLE_NAME, DOMAIN, URL | |
class DynamoDomain(DynamoBase): | |
def get_params(self, key): | |
params = { | |
'TableName': TABLE_NAME, | |
'Key': { | |
URL: {"S": key} | |
} | |
} | |
return params | |
def put_params(self, key, data): | |
params = { | |
'TableName': TABLE_NAME, | |
'Item': { | |
URL: {"S": key}, | |
} | |
} | |
params['Item'].update(data) | |
return params | |
def remove_params(self, key): | |
params = { | |
'TableName': TABLE_NAME, | |
'Key': { | |
URL: {"S": key} | |
} | |
} | |
return params | |
def set_value(self, key, value): | |
params = { | |
DOMAIN: {'S': value} | |
} | |
self.put(key, params) | |
def get_domain(self, key): | |
data = self.get(key) | |
return data['Item'][URL]['S'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment