(key string, side LSide)
| 468 | } |
| 469 | |
| 470 | func (c Client) listFindEnd(key string, side LSide) (node listNode, found bool, err error) { |
| 471 | queryCondition := newExpresionBuilder() |
| 472 | queryCondition.addConditionEquality(c.pk, StringValue{key}) |
| 473 | queryCondition.addConditionEquality(c.skN, IntValue{1}) |
| 474 | |
| 475 | resp, err := c.ddbClient.QueryRequest(&dynamodb.QueryInput{ |
| 476 | ConsistentRead: aws.Bool(true), |
| 477 | ExpressionAttributeNames: queryCondition.expressionAttributeNames(), |
| 478 | ExpressionAttributeValues: queryCondition.expressionAttributeValues(), |
| 479 | IndexName: aws.String(c.index), |
| 480 | KeyConditionExpression: queryCondition.conditionExpression(), |
| 481 | Limit: aws.Int64(capCount), |
| 482 | TableName: aws.String(c.table), |
| 483 | }).Send(context.TODO()) |
| 484 | |
| 485 | if err != nil || len(resp.Items) == 0 { |
| 486 | return |
| 487 | } |
| 488 | |
| 489 | for _, item := range resp.Items { |
| 490 | node = lParseNode(item, c) |
| 491 | node, found, err = c.listGetByAddress(key, node.address) |
| 492 | |
| 493 | if !found || err != nil { |
| 494 | return |
| 495 | } |
| 496 | |
| 497 | if node.prev(side) == listNull { |
| 498 | return node, true, nil |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | return |
| 503 | } |
| 504 | |
| 505 | func (c Client) listGetByAddress(key string, address string) (node listNode, found bool, err error) { |
| 506 | resp, err := c.ddbClient.GetItemRequest(&dynamodb.GetItemInput{ |
no test coverage detected