resolve method

  1. @internal
  2. @override
Future<DoUpdate<T, D>> resolve(
  1. DataAccess<GeneratedDatabase> dataAccess
)
override

Implementation

@internal
@override
Future<DoUpdate<T, D>> resolve(DataAccess dataAccess) async {
  String knowledgeId = await dataAccess.getLocalKnowledgeId();
  return DoUpdate(
    (T old) {
      Insertable<D> result = _creator(old);
      // Because of DoUpdate is always called from Insert, and the INSERT INTO
      // + DO UPDATE behavior is always insert new row, then we should perform
      // syncActionInsert here rather than syncActionUpdate to ensure the sync
      // fields are always valid.
      Insertable<D> syncResult = dataAccess.syncActionInsert(
        result,
        knowledgeId,
      );
      return syncResult;
    },
    target: target,
  );
}