createGraph method

Future<TRow> createGraph(
  1. MssqlGraphInsert<TRow> graph, {
  2. MssqlCycleWrite cycle = MssqlCycleWrite.refuse,
})

Inserts graph and returns the stored root with defaults applied.

Failures roll every write back. Existing counterpart rows are not updated or deleted: this is insert, not sync.

Implementation

Future<TRow> createGraph(
  MssqlGraphInsert<TRow> graph, {
  MssqlCycleWrite cycle = MssqlCycleWrite.refuse,
}) {
  Future<TRow> run(MssqlSession s) async {
    final row =
        await MssqlGraphWriter<TRow>(
          s,
          binding: binding,
          dialect: dialect,
          clock: clock,
          changes: changes,
        )._writeNode(
          binding.erase(),
          graph.values,
          graph.related,
          cycle,
          <String>{},
          <_CycleFix>[],
        );
    return row as TRow;
  }

  return _transact(run);
}