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

Method mset

strings.go:163–204  ·  view source on GitHub ↗
(data map[string]Value, flags Flags)

Source from the content-addressed store, hash-verified

161}
162
163func (c Client) mset(data map[string]Value, flags Flags) (ok bool, err error) {
164 inputs := make([]dynamodb.TransactWriteItem, 0, len(data))
165
166 for k, v := range data {
167 builder := newExpresionBuilder()
168
169 if flags.has(IfNotExists) {
170 builder.addConditionNotExists(c.pk)
171 }
172
173 builder.updateSET(vk, v)
174
175 inputs = append(inputs, dynamodb.TransactWriteItem{
176 Update: &dynamodb.Update{
177 ConditionExpression: builder.conditionExpression(),
178 ExpressionAttributeNames: builder.expressionAttributeNames(),
179 ExpressionAttributeValues: builder.expressionAttributeValues(),
180 Key: keyDef{
181 pk: k,
182 sk: emptySK,
183 }.toAV(c),
184 TableName: aws.String(c.table),
185 UpdateExpression: builder.updateExpression(),
186 },
187 })
188 }
189
190 _, err = c.ddbClient.TransactWriteItemsRequest(&dynamodb.TransactWriteItemsInput{
191 ClientRequestToken: nil,
192 TransactItems: inputs,
193 }).Send(context.TODO())
194
195 if conditionFailureError(err) {
196 return false, nil
197 }
198
199 if err != nil {
200 return false, err
201 }
202
203 return true, nil
204}
205
206// INCRBYFLOAT increments the number stored at the key with the given float64 delta (n = n + delta) and returns
207// the new value. If the key does not exist, it will be initialized with zero before applying

Callers 2

MSETMethod · 0.95
MSETNXMethod · 0.95

Calls 11

newExpresionBuilderFunction · 0.85
conditionFailureErrorFunction · 0.85
hasMethod · 0.80
addConditionNotExistsMethod · 0.80
updateSETMethod · 0.80
conditionExpressionMethod · 0.80
updateExpressionMethod · 0.80
toAVMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected