Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transactions #27

Open
sschneider-ihre-pvs opened this issue Jan 13, 2022 · 0 comments
Open

Transactions #27

sschneider-ihre-pvs opened this issue Jan 13, 2022 · 0 comments

Comments

@sschneider-ihre-pvs
Copy link

Is your feature request related to a problem? Please describe.
It would be nice if Transactions would be supported too.

Describe the solution you'd like
I would like the examples from knex to work

// Using trx as a query builder:
knex.transaction(function(trx) {

  const books = [
    {title: 'Canterbury Tales'},
    {title: 'Moby Dick'},
    {title: 'Hamlet'}
  ];

  return trx
    .insert({name: 'Old Books'}, 'id')
    .into('catalogues')
    .then(function(ids) {
      books.forEach((book) => book.catalogue_id = ids[0]);
      return trx('books').insert(books);
    });
})
.then(function(inserts) {
  console.log(inserts.length + ' new books saved.');
})
.catch(function(error) {
  // If we get here, that means that neither the 'Old Books' catalogues insert,
  // nor any of the books inserts will have taken place.
  console.error(error);
});

Describe alternatives you've considered
Maybe have list of what and what is not supported bei the querylab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant