BulkInsertBuilder class
Builder for creating bulk insert data buffers.
Provides a fluent API to define table structure, columns, and rows for efficient bulk insert operations.
Rows passed to addRow are stored by reference; do not mutate a row list
after it is added (wrap with List.unmodifiable when the same list instance
might be reused elsewhere).
Row-oriented example:
final builder = BulkInsertBuilder()
..table('users')
..addColumn('id', BulkColumnType.i32)
..addColumn('name', BulkColumnType.text, maxLen: 100)
..addRow([1, 'Alice'])
..addRow([2, 'Bob']);
final buffer = builder.build();
Columnar example (avoids per-row List<dynamic> and bulk-copies
fixed-width primitives):
final builder = BulkInsertBuilder()
..table('users')
..addColumnInt32('id', Int32List.fromList([1, 2]))
..addColumnText('name', ['Alice', 'Bob'], maxLen: 100);
final buffer = builder.build();
Constructors
- BulkInsertBuilder()
- Creates a new BulkInsertBuilder instance.
Properties
-
columnNames
→ List<
String> -
Gets the list of column names in the order they were added.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- rowCount → int
-
Gets the number of rows in the builder (row- or column-oriented).
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tableName → String
-
Gets the table name.
no setterinherited
Methods
-
addColumn(
String name, BulkColumnType colType, {bool nullable = false, int maxLen = 0}) → BulkInsertBuilder -
Adds a column definition to the bulk insert.
inherited
-
addColumnBinary(
String name, List< Uint8List> values, {bool nullable = false, int maxLen = 0, List<bool> ? isNull}) → BulkInsertBuilder -
Adds a binary column from Uint8List cells (columnar mode).
inherited
-
addColumnDecimal(
String name, List< String> values, {bool nullable = false, int maxLen = 0, List<bool> ? isNull}) → BulkInsertBuilder -
Adds a decimal column from string literals (columnar mode).
inherited
-
addColumnInt32(
String name, Int32List values, {bool nullable = false, List< bool> ? isNull}) → BulkInsertBuilder -
Adds an i32 column from a typed Int32List (columnar mode).
inherited
-
addColumnInt64(
String name, Int64List values, {bool nullable = false, List< bool> ? isNull}) → BulkInsertBuilder -
Adds an i64 column from a typed Int64List (columnar mode).
inherited
-
addColumnText(
String name, List< String> values, {bool nullable = false, int maxLen = 0, List<bool> ? isNull}) → BulkInsertBuilder -
Adds a text column from a List of UTF-8 strings (columnar mode).
inherited
-
addColumnTimestamp(
String name, List< Object> values, {bool nullable = false, List<bool> ? isNull}) → BulkInsertBuilder -
Adds a timestamp column from DateTime or BulkTimestamp values.
inherited
-
addRow(
List values) → BulkInsertBuilder -
Adds a row of data to the bulk insert.
inherited
-
build(
{BulkPayloadVersion version = BulkPayloadVersion.v2}) → Uint8List -
Builds the binary data buffer for bulk insert.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
table(
String name) → BulkInsertBuilder -
Sets the target table name for the bulk insert.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited