Batch class abstract

Base class for a transactional batch.

Implementers

Constructors

Batch(CosmosDbContainer container, PartitionKey? partitionKey)

Properties

container CosmosDbContainer
The container this batch instance is attached to.
final
continueOnError bool
If true, processing will continue after an error. Otherwise, processing is stopped and subsequent operations fail with a 424 HttpStatusCode.failedDependency status code.
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
The document's id.
finalinherited
isAtomic bool
If true, modifications are persisted to the container atomically. If an error occurs during processing, no modifications are persisted and all other operations fail with a 424 HttpStatusCode.failedDependency status code.
no setter
isCrossPartition bool
If true, operations registered with this batch may target multiple partition keys. Operations will be grouped by partition keys when execute is called. Implies continueOnError = true and isAtomic = false.
no setter
length int
The number of operations in this batch instance.
no setter
operations Iterable<BatchOperation>
The list of operations registered with this batch instance.
no setter
partitionKey PartitionKey?
The default partition key for operations in this batch.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(BatchOperation op) → void
Adds the specified BatchOperation to this batch instance.
create<T extends BaseDocument>(T item, {PartitionKey? partitionKey}) → void
Adds a BatchOperationCreate to this batch instance.
delete(String id, {PartitionKey? partitionKey}) → void
Adds a BatchOperationDelete to this batch instance.
execute({CosmosDbPermission? permission}) Future<BatchResponse>
Executes the BatchOperations registered in this batch instance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch<T extends BaseDocument>(String id, {PartitionKey? partitionKey}) BatchOperationPatch<BaseDocument>
Adds a BatchOperationPatch to this batch instance.
read<T extends BaseDocument>(String id, {PartitionKey? partitionKey}) → void
Adds a BatchOperationRead to this batch instance.
recycle() → void
Recycles this batch instance for reuse. This method clears the list of operations.
replace<T extends BaseDocument>(T item, {PartitionKey? partitionKey}) → void
Adds a BatchOperationReplace to this batch instance.
toJson() → dynamic
Serializes this instance to a JSON object.
inherited
toString() String
A string representation of this object.
inherited
upsert<T extends BaseDocument>(T item, {PartitionKey? partitionKey}) → void
Adds a BatchOperationUpsert to this batch instance.

Operators

operator ==(Object other) bool
The equality operator.
inherited