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

Method updateSideAction

lists.go:163–185  ·  view source on GitHub ↗
(side LSide, newAddress string, c Client)

Source from the content-addressed store, hash-verified

161}
162
163func (ln listNode) updateSideAction(side LSide, newAddress string, c Client) dynamodb.TransactWriteItem {
164 updater := newExpresionBuilder()
165 updater.addConditionEquality(ln.prevAttr(side), StringValue{ln.prev(side)})
166 updater.addConditionEquality(ln.nextAttr(side), StringValue{ln.next(side)})
167 updater.updateSET(ln.prevAttr(side), StringValue{newAddress})
168
169 if newAddress == listNull || ln.next(side) == listNull {
170 updater.updateSET(c.skN, IntValue{1})
171 } else {
172 updater.updateSET(c.skN, IntValue{0})
173 }
174
175 return dynamodb.TransactWriteItem{
176 Update: &dynamodb.Update{
177 ConditionExpression: updater.conditionExpression(),
178 ExpressionAttributeNames: updater.expressionAttributeNames(),
179 ExpressionAttributeValues: updater.expressionAttributeValues(),
180 Key: ln.keyAV(c),
181 TableName: aws.String(c.table),
182 UpdateExpression: updater.updateExpression(),
183 },
184 }
185}
186
187func (ln listNode) isTail() bool {
188 return ln.right == listNull

Callers 5

LINSERTMethod · 0.80
listPopActionsMethod · 0.80
listPushActionsMethod · 0.80
LREMMethod · 0.80
listRotateMethod · 0.80

Calls 13

prevAttrMethod · 0.95
prevMethod · 0.95
nextAttrMethod · 0.95
nextMethod · 0.95
keyAVMethod · 0.95
newExpresionBuilderFunction · 0.85
addConditionEqualityMethod · 0.80
updateSETMethod · 0.80
conditionExpressionMethod · 0.80
updateExpressionMethod · 0.80

Tested by

no test coverage detected