5.2.1 • Published 5 years ago

@xgraph/tx v5.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

graph-tx

Isolated Transactions for the @xgraph/core graph

Usage

const createTransaction = require('graph-tx');
const g = require('./graph');
const tx = createTransaction.bind(null, g);

tx(({ graph, commit }) => {
  graph.setVertex(...);
  commit(); // mark tx as done
});

tx(({ graph }) => {
  graph.setVertex(...);
  // auto commit on successful termination of transaction
});

tx(({ graph, rollback }) => {
  graph.setVertex(...);
  rollback(); // rollback changes and mark as done
});

tx(({ graph }) => {
  graph.setVertex(...);
  throw new Error(); // auto rollback on errors
});

tx(({ graph, commit, rollback }) => {
  // do stuff
}, {
  onCommit() {
    // do stuff after commit
  },
  onRollback(err) {
    // do stuff after rollback
  }
});
5.2.1

5 years ago

5.2.0

5 years ago

5.1.0

5 years ago

5.0.1

5 years ago

4.4.1

5 years ago

4.3.0

5 years ago

4.2.0

5 years ago

4.0.0

5 years ago

1.0.0

5 years ago