insert method

Future<List<UserModel>> insert(
  1. List<UserModel> models
)

Insert list users

Implementation

Future<List<UserModel>> insert(List<UserModel> models) async {
  final ids = <int>[];
  await _db.transaction(() async {
    for (final model in models) {
      ids.add(await _db.into(_db.users).insert(model.toCompanion()));
    }
  });
  return (_db.select(_db.users)..where((tbl) => tbl.id.isIn(ids))).get();
}