GET fetches the value at the given key. If the key does not exist, the ReturnValue will be Empty(). Works similar to https://redis.io/commands/get
(key string)
| 14 | // |
| 15 | // Works similar to https://redis.io/commands/get |
| 16 | func (c Client) GET(key string) (val ReturnValue, err error) { |
| 17 | resp, err := c.ddbClient.GetItemRequest(&dynamodb.GetItemInput{ |
| 18 | ConsistentRead: aws.Bool(c.consistentReads), |
| 19 | Key: keyDef{pk: key, sk: emptySK}.toAV(c), |
| 20 | TableName: aws.String(c.table), |
| 21 | }).Send(context.TODO()) |
| 22 | if err != nil || len(resp.Item) == 0 { |
| 23 | return |
| 24 | } |
| 25 | |
| 26 | val = ReturnValue{resp.Item[vk]} |
| 27 | |
| 28 | return |
| 29 | } |
| 30 | |
| 31 | // SET stores the given Value at the given key. If called as SET("key", "value", None), SET is |
| 32 | // unconditional and is not expected to fail. |