beginTransaction method

Future<ArangoTransaction> beginTransaction(
  1. {List<String> exclusive,
  2. List<String> write,
  3. List<String> read,
  4. bool allowImplicit,
  5. int lockTimeout,
  6. int maxTransactionSize,
  7. bool waitForSync}
)

Implementation

Future<ArangoTransaction> beginTransaction({
  List<String> exclusive,
  List<String> write,
  List<String> read,
  bool allowImplicit,
  int lockTimeout,
  int maxTransactionSize,
  bool waitForSync,
}) async {
  final resp = await _connection.request(
    method: 'POST',
    path: '/_api/transaction/begin',
    body: {
      'collections': {
        if (exclusive != null) 'exclusive': exclusive,
        if (write != null) 'write': write,
        if (read != null) 'read': read,
      },
      if (allowImplicit != null) 'allowImplicit': allowImplicit,
      if (lockTimeout != null) 'lockTimeout': lockTimeout,
      if (maxTransactionSize != null)
        'maxTransactionSize': maxTransactionSize,
      if (waitForSync != null) 'waitForSync': waitForSync,
    },
  );
  return ArangoTransaction(_connection, resp.body['result']['id']);
}