(data map[string]Value, flags Flags)
| 161 | } |
| 162 | |
| 163 | func (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 |
no test coverage detected