DocumentClient class
The document client simplifies working with items in Amazon DynamoDB by abstracting away the notion of attribute values. This abstraction annotates native Dart types supplied as input parameters, as well as converts annotated response data to native Dart types.
Marshalling Input and Unmarshalling Response Data
The document client affords developers the use of native Dart types
instead of AttributeValue
s to simplify the Dart development
experience with Amazon DynamoDB. Dart objects passed in as parameters
are marshalled into AttributeValue
shapes required by Amazon DynamoDB.
Responses from DynamoDB are unmarshalled into plain Dart objects
by the DocumentClient
. The DocumentClient
, does not accept
AttributeValue
s in favor of native Dart types.
Dart Type | DynamoDB AttributeValue |
---|---|
String | S |
int, double | N |
bool | BOOL |
null | NULL |
List | NS |
List | BS |
Set | SS |
List | L |
Map | M |
Uint8List | B |
Support for Sets
The DocumentClient
offers a convenient way to create sets from
Dart Arrays. The type of set is inferred from the first element
in the array. DynamoDB supports string, number, and binary sets. To
learn more about supported types see the
Amazon DynamoDB Data Model Documentation
For more information see {AWS.DynamoDB.DocumentClient.createSet}
Constructors
- DocumentClient({required String region, DynamoDB? dynamoDB, AwsClientCredentials? credentials, String? endpointUrl, Client? client})
Properties
Methods
-
batchGet(
{ReturnConsumedCapacity? returnConsumedCapacity, required Map< String, KeysAndProjection> requestItems}) → Future<BatchGetOutput> - Returns the attributes of one or more items from one or more tables by delegating to DynamoDB.batchGetItem().
-
batchWrite(
{required Map< String, List< requestItems, ReturnConsumedCapacity? returnConsumedCapacity, ReturnItemCollectionMetrics? returnItemCollectionMetrics}) → Future<Write> >BatchWriteOutput> - Puts or deletes multiple items in one or more tables by delegating to DynamoDB.batchWriteItem().
-
delete(
{required Map< String, dynamic> key, required String tableName, String? conditionExpression, ConditionalOperator? conditionalOperator, Map<String, ExpectedAttributeValueDC> ? expected, Map<String, String> ? expressionAttributeNames, Map<String, dynamic> ? expressionAttributeValues, ReturnConsumedCapacity? returnConsumedCapacity, ReturnItemCollectionMetrics? returnItemCollectionMetrics, ReturnValue? returnValues}) → Future<OperationOutput> - Deletes a single item in a table by primary key by delegating to DynamoDB.deleteItem().
-
get(
{required String tableName, required Map< String, dynamic> key, List<String> ? attributesToGet, bool? consistentRead, Map<String, String> ? expressionAttributeNames, String? projectionExpression, ReturnConsumedCapacity? returnConsumedCapacity}) → Future<GetOutput> - Returns a set of attributes for the item with the given primary key by delegating to DynamoDB.getItem().
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
{required Map< String, dynamic> item, required String tableName, String? conditionExpression, ConditionalOperator? conditionalOperator, Map<String, ExpectedAttributeValueDC> ? expected, Map<String, String> ? expressionAttributeNames, Map<String, dynamic> ? expressionAttributeValues, ReturnConsumedCapacity? returnConsumedCapacity, ReturnItemCollectionMetrics? returnItemCollectionMetrics, ReturnValue? returnValues}) → Future<OperationOutput> - Creates a new item, or replaces an old item with a new item by delegating to AWS.DynamoDB.putItem().
-
query(
{required String tableName, List< String> ? attributesToGet, ConditionalOperator? conditionalOperator, bool? consistentRead, Map<String, dynamic> ? exclusiveStartKey, Map<String, String> ? expressionAttributeNames, Map<String, dynamic> ? expressionAttributeValues, String? filterExpression, String? indexName, String? keyConditionExpression, Map<String, ConditionDC> ? keyConditions, int? limit, String? projectionExpression, Map<String, ConditionDC> ? queryFilter, ReturnConsumedCapacity? returnConsumedCapacity, bool? scanIndexForward, Select? select}) → Future<QueryOutputDC> - Directly access items from a table by primary key or a secondary index.
-
scan(
{required String tableName, List< String> ? attributesToGet, ConditionalOperator? conditionalOperator, bool? consistentRead, Map<String, dynamic> ? exclusiveStartKey, Map<String, String> ? expressionAttributeNames, Map<String, dynamic> ? expressionAttributeValues, String? filterExpression, String? indexName, int? limit, String? projectionExpression, ReturnConsumedCapacity? returnConsumedCapacity, Map<String, ConditionDC> ? scanFilter, int? segment, Select? select, int? totalSegments}) → Future<QueryOutputDC> - Returns one or more items and item attributes by accessing every item in a table or a secondary index.
-
toString(
) → String -
A string representation of this object.
inherited
-
transactGet(
{required List< GetDC> transactItems, ReturnConsumedCapacity? returnConsumedCapacity}) → Future<TransactGetOutput> - Atomically retrieves multiple items from one or more tables (but not from indexes) in a single account and region.
-
transactWrite(
{required List< TransactWrite> transactItems, String? clientRequestToken, ReturnConsumedCapacity? returnConsumedCapacity, ReturnItemCollectionMetrics? returnItemCollectionMetrics}) → Future<void> - Synchronous write operation that groups up to 10 action requests
-
update(
{required Map< String, dynamic> key, required String tableName, Map<String, UpdateDC> ? attributeUpdates, String? conditionExpression, ConditionalOperator? conditionalOperator, Map<String, ExpectedAttributeValueDC> ? expected, Map<String, String> ? expressionAttributeNames, Map<String, dynamic> ? expressionAttributeValues, ReturnConsumedCapacity? returnConsumedCapacity, ReturnItemCollectionMetrics? returnItemCollectionMetrics, ReturnValue? returnValues, String? updateExpression}) → Future<OperationOutput> - Edits an existing item's attributes, or adds a new item to the table if it does not already exist by delegating to AWS.DynamoDB.updateItem().
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited