MCPcopy Create free account
hub / github.com/dbProjectRED/redimo.go / HMGET

Method HMGET

hashes.go:86–113  ·  view source on GitHub ↗
(key string, fields ...string)

Source from the content-addressed store, hash-verified

84}
85
86func (c Client) HMGET(key string, fields ...string) (values map[string]ReturnValue, err error) {
87 values = make(map[string]ReturnValue)
88 items := make([]dynamodb.TransactGetItem, len(fields))
89
90 for i, field := range fields {
91 items[i] = dynamodb.TransactGetItem{Get: &dynamodb.Get{
92 Key: keyDef{
93 pk: key,
94 sk: field,
95 }.toAV(c),
96 ProjectionExpression: aws.String(strings.Join([]string{c.sk, vk}, ", ")),
97 TableName: aws.String(c.table),
98 }}
99 }
100
101 resp, err := c.ddbClient.TransactGetItemsRequest(&dynamodb.TransactGetItemsInput{
102 TransactItems: items,
103 }).Send(context.TODO())
104
105 if err == nil {
106 for _, r := range resp.Responses {
107 pi := parseItem(r.Item, c)
108 values[pi.sk] = pi.val
109 }
110 }
111
112 return
113}
114
115func (c Client) HDEL(key string, fields ...string) (deletedFields []string, err error) {
116 for _, field := range fields {

Callers 1

TestAtomicHashOpsFunction · 0.80

Calls 3

parseItemFunction · 0.85
toAVMethod · 0.45
StringMethod · 0.45

Tested by 1

TestAtomicHashOpsFunction · 0.64