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

Method sequenceUpdateAction

streams.go:63–78  ·  view source on GitHub ↗
(key string, c Client)

Source from the content-addressed store, hash-verified

61}
62
63func (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.
81func (xid XID) Next() XID {

Callers 1

XADDMethod · 0.80

Calls 11

StringMethod · 0.95
newExpresionBuilderFunction · 0.85
xSequenceKeyFunction · 0.85
conditionMethod · 0.80
conditionExpressionMethod · 0.80
updateExpressionMethod · 0.80
ToAVMethod · 0.65
SETMethod · 0.45
toAVMethod · 0.45

Tested by

no test coverage detected