insertAll method

  1. @override
Future<int> insertAll(
  1. List<AvatarModel?> t, {
  2. String? tableName,
  3. String? nullColumnHack,
  4. ConflictAlgorithm? conflictAlgorithm = ConflictAlgorithm.replace,
})
inherited

插入所有model

Implementation

@override
Future<int> insertAll(
  List<T?> t, {
  String? tableName,
  String? nullColumnHack,
  ConflictAlgorithm? conflictAlgorithm = ConflictAlgorithm.replace,
}) async {
  final _batch = _db.batch();
  for (T? c in t) {
    if (c == null) continue;
    Map<String, dynamic> values = c.toJson();
    _convertSafeMap(values);
    _batch.insert(
      tableName ?? table,
      values,
      nullColumnHack: nullColumnHack,
      conflictAlgorithm: conflictAlgorithm,
    );
  }
  await _batch.commit(noResult: true);
  return Future.value(0);
}