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

Method RPOPLPUSH

lists.go:686–710  ·  view source on GitHub ↗
(sourceKey string, destinationKey string)

Source from the content-addressed store, hash-verified

684}
685
686func (c Client) RPOPLPUSH(sourceKey string, destinationKey string) (element ReturnValue, err error) {
687 if sourceKey == destinationKey {
688 return c.listRotate(sourceKey)
689 }
690
691 element, popTransactionItems, ok, err := c.listPopActions(sourceKey, Right)
692 if err != nil || !ok {
693 return
694 }
695
696 pushTransactionItems, err := c.listPushActions(destinationKey, element, Left, Flags{})
697
698 if err != nil {
699 return
700 }
701
702 var transactItems []dynamodb.TransactWriteItem
703 transactItems = append(transactItems, popTransactionItems...)
704 transactItems = append(transactItems, pushTransactionItems...)
705 _, err = c.ddbClient.TransactWriteItemsRequest(&dynamodb.TransactWriteItemsInput{
706 TransactItems: transactItems,
707 }).Send(context.TODO())
708
709 return
710}
711
712func (c Client) listRotate(key string) (element ReturnValue, err error) {
713 var actions []dynamodb.TransactWriteItem

Callers 1

TestRPOPLPUSHFunction · 0.80

Calls 3

listRotateMethod · 0.95
listPopActionsMethod · 0.95
listPushActionsMethod · 0.95

Tested by 1

TestRPOPLPUSHFunction · 0.64