MssqlBulkWriter<TRow> class

Batched insert, keyed staging update, and quantity decrement.

Separate from MssqlWriteEngine because a multi-row write has a different contract: VALUES vs BCP is a caller choice, OUTPUT order is never trusted, and a failed batch rolls the whole call back by default.

Annotations
  • @immutable

Constructors

MssqlBulkWriter(MssqlSession session, {required MssqlTableBinding<TRow> binding, required MssqlDialect dialect, MssqlClock clock = MssqlClock.serverUtc, MssqlChangeHub? changes, List<MssqlCondition> scopes = const <MssqlCondition>[]})

Properties

binding MssqlTableBinding<TRow>
final
changes MssqlChangeHub?
final
clock MssqlClock
final
dialect MssqlDialect
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scopes List<MssqlCondition>
The query's resolved scope predicates — tenant, soft delete, any other global scope — that every row this writer touches has to satisfy.
final
session → MssqlSession
final

Methods

createMany(List<MssqlWriteAssignments> rows, {MssqlCreateManyStrategy strategy = MssqlCreateManyStrategy.insertValues, MssqlBulkOptions bulk = const MssqlBulkOptions(), bool atomic = true, bool returnRows = true}) Future<MssqlCreateManyResult<TRow>>
Inserts rows, batched under SQL Server's ceilings.
decrementQuantities({required String keyColumn, required String quantityColumn, required Iterable<({num amount, Object key})> requests}) Future<int>
Groups requests by keyColumn, refuses non-positive amounts, then one UPDATE … JOIN that subtracts only when the stored quantity still covers the request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateMany(List<MssqlKeyedPatch> patches, {int? expectAffected}) Future<int>
Staging JOIN update of patches by their keys.

Operators

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