(key string, index int64)
| 230 | } |
| 231 | |
| 232 | func (c Client) listNodeAtIndex(key string, index int64) (node listNode, found bool, err error) { |
| 233 | side := Left |
| 234 | if index < 0 { |
| 235 | side = Right |
| 236 | index = -index - 1 |
| 237 | } |
| 238 | |
| 239 | node, found, err = c.listFindEnd(key, side) |
| 240 | i := int64(0) |
| 241 | |
| 242 | for found { |
| 243 | if err != nil { |
| 244 | return |
| 245 | } |
| 246 | |
| 247 | if i == index { |
| 248 | return node, true, nil |
| 249 | } |
| 250 | |
| 251 | node, found, err = c.listGetByAddress(key, node.next(side)) |
| 252 | i++ |
| 253 | } |
| 254 | |
| 255 | return node, false, nil |
| 256 | } |
| 257 | |
| 258 | // LINSERT inserts the given element on the given side of the pivot element. |
| 259 | func (c Client) LINSERT(key string, side LSide, pivot, element Value) (newLength int64, done bool, err error) { |
no test coverage detected