(key string, c Client)
| 61 | } |
| 62 | |
| 63 | func (xid XID) sequenceUpdateAction(key string, c Client) dynamodb.TransactWriteItem { |
| 64 | builder := newExpresionBuilder() |
| 65 | builder.condition(fmt.Sprintf("#%v < :%v", vk, vk), vk) |
| 66 | builder.SET(fmt.Sprintf("#%v = :%v", vk, vk), vk, StringValue{xid.String()}.ToAV()) |
| 67 | |
| 68 | return dynamodb.TransactWriteItem{ |
| 69 | Update: &dynamodb.Update{ |
| 70 | ConditionExpression: builder.conditionExpression(), |
| 71 | ExpressionAttributeNames: builder.expressionAttributeNames(), |
| 72 | ExpressionAttributeValues: builder.expressionAttributeValues(), |
| 73 | Key: xSequenceKey(key).toAV(c), |
| 74 | TableName: aws.String(c.table), |
| 75 | UpdateExpression: builder.updateExpression(), |
| 76 | }, |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | // Next returns the next valid XID at the same time – it simply returns a new XID with the next sequence number. |
| 81 | func (xid XID) Next() XID { |
no test coverage detected