setDelta method
Implementation
@override
Future<bool> setDelta({
required String directive,
required String mid,
required Map<String, dynamic>? delta,
}) async {
await initialize();
Map<String, dynamic> input = makeData(directive: directive, mid: mid, delta: delta);
try {
final Map<String, dynamic> target = await HycopFactory.dataBase!.getData('hycop_delta', mid);
if (target.isEmpty) {
logger.finest('createDelta = ${input.toString()}');
HycopFactory.dataBase!.createData('hycop_delta', mid, input);
return true;
}
logger.finest('setDelta = ${input.toString()}');
// delta 내용이 달라진게 없으면 쓰지 않는다.
String? orgDelta = target['delta'];
String? newDelta = input['delta'];
if (orgDelta != null && newDelta != null && orgDelta == newDelta) {
logger.info('!!!! same delta !!!!, setDelta skipped');
return false;
}
HycopFactory.dataBase!.setData('hycop_delta', mid, input);
return true;
} catch (e) {
logger.finest('database error $e');
return false;
}
}