upsert method

Future<int> upsert(
  1. T item
)

Upsert

Implementation

Future<int> upsert(T item) async {
  final db = await JDB.instance.database;

  final map = item.toMap();

  final result = await db.insert(
    table,
    map,
    conflictAlgorithm: ConflictAlgorithm.replace,
  );

  jLog.t('Add $table: $item');

  return result;
}