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

Method listPopActions

lists.go:366–390  ·  view source on GitHub ↗
(key string, side LSide)

Source from the content-addressed store, hash-verified

364}
365
366func (c Client) listPopActions(key string, side LSide) (element ReturnValue, actions []dynamodb.TransactWriteItem, ok bool, err error) {
367 endNode, ok, err := c.listFindEnd(key, side)
368 if err != nil || !ok {
369 return
370 }
371
372 element = endNode.value
373
374 penultimateNodeAddress := endNode.next(side)
375 if penultimateNodeAddress != listNull {
376 penultimateKeyNode, found, err := c.listGetByAddress(key, penultimateNodeAddress)
377 if !found || err != nil {
378 return element, actions, false, err
379 }
380
381 penultimateKeyNode.setPrev(side, endNode.address)
382
383 actions = append(actions, penultimateKeyNode.updateSideAction(side, listNull, c))
384 }
385
386 actions = append(actions, endNode.deleteAction(c))
387 actions = append(actions, c.listCountDeltaAction(key, -1))
388
389 return
390}
391
392func (c Client) LPUSH(key string, elements ...Value) (newLength int64, err error) {
393 for _, element := range elements {

Callers 2

listPopMethod · 0.95
RPOPLPUSHMethod · 0.95

Calls 7

listFindEndMethod · 0.95
listGetByAddressMethod · 0.95
listCountDeltaActionMethod · 0.95
nextMethod · 0.80
setPrevMethod · 0.80
updateSideActionMethod · 0.80
deleteActionMethod · 0.80

Tested by

no test coverage detected