commit method

  1. @override
Future<HGrid> commit(
  1. Iterable<HDict> diffs,
  2. CommitOperator operator, {
  3. bool force = false,
})

Commits a set of diffs.

operator defines the commit operation: /// add: adds records into the database and returns a grid with the newly minted record identifiers. As a general rule you should not have an id column in your commit grid. However if you wish to predefine the id of the records, you can specify an id column in the commit grid. /// update: modified existing records, the records must have both an id and mod column, /// remove: removes existing records, the records should have only an id and mod column,

If an error occurs an error grid is returned.

For add and update, the result grid contains the id and mod. If the request grid meta defines the readReturn marker tag, then the response contains the full tag definitions of the new/updated records.

Commit access requires admin permission for the project.

Note you can also commit by evaluating axon expressions which use the commit function. But with large datasets committing directly through REST API can be more efficient.

Implementation

@override
Future<HGrid> commit(Iterable<HDict> diffs, CommitOperator operator, {bool force = false}) {
  var meta = HDictBuilder().add('commit', commitToString(operator));
  if (force) {
    meta.add('force');
  }

  var grid = HGridBuilder.dictsToGrid(meta.toDict(), diffs.toList());
  return call("commit", grid);
}