public final class DefaultDynamoDbAsyncIndex<T> extends Object implements DynamoDbAsyncIndex<T>
Modifier and Type | Method and Description |
---|---|
DynamoDbAsyncClient |
dynamoDbClient() |
boolean |
equals(Object o) |
int |
hashCode() |
String |
indexName()
Gets the physical secondary index name that operations performed by this object will be executed against.
|
Key |
keyFrom(T item)
Creates a
Key object from a modelled item. |
DynamoDbEnhancedClientExtension |
mapperExtension()
Gets the
DynamoDbEnhancedClientExtension associated with this mapped resource. |
SdkPublisher<Page<T>> |
query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)
Executes a query against a secondary index using a
QueryConditional expression to retrieve a list of
items matching the given conditions. |
SdkPublisher<Page<T>> |
query(QueryConditional queryConditional)
Executes a query against the secondary index of the table using a
QueryConditional expression to retrieve
a list of items matching the given conditions. |
SdkPublisher<Page<T>> |
query(QueryEnhancedRequest request)
Executes a query against a secondary index using a
QueryConditional expression to retrieve a list of
items matching the given conditions. |
SdkPublisher<Page<T>> |
scan()
Scans the table against a secondary index and retrieves all items using default settings.
|
SdkPublisher<Page<T>> |
scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)
Scans the table against a secondary index and retrieves all items.
|
SdkPublisher<Page<T>> |
scan(ScanEnhancedRequest request)
Scans the table against a secondary index and retrieves all items.
|
String |
tableName()
Gets the physical table name that operations performed by this object will be executed against.
|
TableSchema<T> |
tableSchema()
Gets the
TableSchema object that this mapped table was built with. |
public SdkPublisher<Page<T>> query(QueryEnhancedRequest request)
DynamoDbAsyncIndex
QueryConditional
expression to retrieve a list of
items matching the given conditions.
The result is accessed through iterable pages (see Page
) in an interactive way; each time a
result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found,
the resulting iterator will contain an empty page. Results are sorted by sort key value in
ascending order by default; this behavior can be overridden in the QueryEnhancedRequest
.
The additional configuration parameters that the enhanced client supports are defined
in the QueryEnhancedRequest
.
This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for further details and constraints.
Example:
QueryConditional queryConditional = QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build());
SdkPublisher<Page<MyItem>> publisher = mappedIndex.query(QueryEnhancedRequest.builder()
.queryConditional(queryConditional)
.build());
query
in interface DynamoDbAsyncIndex<T>
request
- A QueryEnhancedRequest
defining the query conditions and how
to handle the results.SdkPublisher
with paginated results (see Page
).public SdkPublisher<Page<T>> query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)
DynamoDbAsyncIndex
QueryConditional
expression to retrieve a list of
items matching the given conditions.
The result is accessed through iterable pages (see Page
) in an interactive way; each time a
result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found,
the resulting iterator will contain an empty page. Results are sorted by sort key value in
ascending order by default; this behavior can be overridden in the QueryEnhancedRequest
.
The additional configuration parameters that the enhanced client supports are defined
in the QueryEnhancedRequest
.
This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for further details and constraints.
Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one
manually via QueryEnhancedRequest.builder()
.
Example:
SdkPublisher<Page<MyItem>> publisher =
mappedIndex.query(r -> r.queryConditional(QueryConditional.keyEqualTo(k -> k.partitionValue("id-value"))));
query
in interface DynamoDbAsyncIndex<T>
requestConsumer
- A Consumer
of QueryEnhancedRequest
defining the query conditions and how to
handle the results.SdkPublisher
with paginated results (see Page
).public SdkPublisher<Page<T>> query(QueryConditional queryConditional)
DynamoDbAsyncIndex
QueryConditional
expression to retrieve
a list of items matching the given conditions.
The result is accessed through iterable pages (see Page
) in an interactive way; each time a
result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found,
the resulting iterator will contain an empty page. Results are sorted by sort key value in
ascending order.
This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for further details and constraints.
Example:
SdkPublisher<Page<MyItem>> results =
mappedIndex.query(QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build()));
query
in interface DynamoDbAsyncIndex<T>
queryConditional
- A QueryConditional
defining the matching criteria for records to be queried.SdkPublisher
with paginated results (see Page
).public SdkPublisher<Page<T>> scan(ScanEnhancedRequest request)
DynamoDbAsyncIndex
The result is accessed through iterable pages (see Page
) in an interactive way; each time a
result page is retrieved, a scan call is made to DynamoDb to get those entries. If no matches are found,
the resulting iterator will contain an empty page.
The additional configuration parameters that the enhanced client supports are defined
in the ScanEnhancedRequest
.
Example:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan(ScanEnhancedRequest.builder().consistentRead(true).build());
scan
in interface DynamoDbAsyncIndex<T>
request
- A ScanEnhancedRequest
defining how to handle the results.SdkPublisher
with paginated results (see Page
).public SdkPublisher<Page<T>> scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)
DynamoDbAsyncIndex
The result is accessed through iterable pages (see Page
) in an interactive way; each time a
result page is retrieved, a scan call is made to DynamoDb to get those entries. If no matches are found,
the resulting iterator will contain an empty page.
The additional configuration parameters that the enhanced client supports are defined
in the ScanEnhancedRequest
.
Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one
manually via ScanEnhancedRequest.builder()
.
Example:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan(r -> r.limit(5));
scan
in interface DynamoDbAsyncIndex<T>
requestConsumer
- A Consumer
of ScanEnhancedRequest
defining the query conditions and how to
handle the results.SdkPublisher
with paginated results (see Page
).public SdkPublisher<Page<T>> scan()
DynamoDbAsyncIndex
The result is accessed through iterable pages (see Page
) in an interactive way; each time a
result page is retrieved, a scan call is made to DynamoDb to get those entries. If no matches are found,
the resulting iterator will contain an empty page.
Example:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan();
scan
in interface DynamoDbAsyncIndex<T>
SdkPublisher
with paginated results (see Page
).public DynamoDbEnhancedClientExtension mapperExtension()
DynamoDbAsyncIndex
DynamoDbEnhancedClientExtension
associated with this mapped resource.mapperExtension
in interface DynamoDbAsyncIndex<T>
DynamoDbEnhancedClientExtension
associated with this mapped resource.public TableSchema<T> tableSchema()
DynamoDbAsyncIndex
TableSchema
object that this mapped table was built with.tableSchema
in interface DynamoDbAsyncIndex<T>
TableSchema
object for this mapped table.public DynamoDbAsyncClient dynamoDbClient()
public String tableName()
DynamoDbAsyncIndex
tableName
in interface DynamoDbAsyncIndex<T>
public String indexName()
DynamoDbAsyncIndex
indexName
in interface DynamoDbAsyncIndex<T>
public Key keyFrom(T item)
DynamoDbAsyncIndex
Key
object from a modelled item. This key can be used in query conditionals and get
operations to locate a specific record.keyFrom
in interface DynamoDbAsyncIndex<T>
item
- The item to extract the key fields from.Copyright © 2022. All rights reserved.