{"action":"created","issue":{"url":"https://api.github.com/repos/vitaly-t/pg-promise/issues/500","repository_url":"https://api.github.com/repos/vitaly-t/pg-promise","labels_url":"https://api.github.com/repos/vitaly-t/pg-promise/issues/500/labels{/name}","comments_url":"https://api.github.com/repos/vitaly-t/pg-promise/issues/500/comments","events_url":"https://api.github.com/repos/vitaly-t/pg-promise/issues/500/events","html_url":"https://github.com/vitaly-t/pg-promise/issues/500","id":308079229,"number":500,"title":"Question: Async/Await Transactions","user":{"login":"jdalrymple","id":3743662,"avatar_url":"https://avatars3.githubusercontent.com/u/3743662?v=4","gravatar_id":"","url":"https://api.github.com/users/jdalrymple","html_url":"https://github.com/jdalrymple","followers_url":"https://api.github.com/users/jdalrymple/followers","following_url":"https://api.github.com/users/jdalrymple/following{/other_user}","gists_url":"https://api.github.com/users/jdalrymple/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalrymple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalrymple/subscriptions","organizations_url":"https://api.github.com/users/jdalrymple/orgs","repos_url":"https://api.github.com/users/jdalrymple/repos","events_url":"https://api.github.com/users/jdalrymple/events{/privacy}","received_events_url":"https://api.github.com/users/jdalrymple/received_events","type":"User","site_admin":false},"labels":[{"id":183000955,"url":"https://api.github.com/repos/vitaly-t/pg-promise/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-23T15:40:34Z","updated_at":"2018-03-23T16:53:16Z","closed_at":null,"author_association":"NONE","body":"Is there a way to run transactions in this fashion:\r\n\r\n```\r\nconst t = db.tx('my transaction');\r\n\r\ntry {\r\n    const value1 = t.one('my query)\r\n\r\n    await t.commit()\r\n} catch(e) {\r\n    await t.rollback()\r\n}\r\n```\r\n\r\nSimilar to : https://node-postgres.com/features/transactions\r\n\r\nThank you !"},"comment":{"url":"https://api.github.com/repos/vitaly-t/pg-promise/issues/comments/375730865","html_url":"https://github.com/vitaly-t/pg-promise/issues/500#issuecomment-375730865","issue_url":"https://api.github.com/repos/vitaly-t/pg-promise/issues/500","id":375730865,"user":{"login":"vitaly-t","id":5108906,"avatar_url":"https://avatars1.githubusercontent.com/u/5108906?v=4","gravatar_id":"","url":"https://api.github.com/users/vitaly-t","html_url":"https://github.com/vitaly-t","followers_url":"https://api.github.com/users/vitaly-t/followers","following_url":"https://api.github.com/users/vitaly-t/following{/other_user}","gists_url":"https://api.github.com/users/vitaly-t/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaly-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaly-t/subscriptions","organizations_url":"https://api.github.com/users/vitaly-t/orgs","repos_url":"https://api.github.com/users/vitaly-t/repos","events_url":"https://api.github.com/users/vitaly-t/events{/privacy}","received_events_url":"https://api.github.com/users/vitaly-t/received_events","type":"User","site_admin":false},"created_at":"2018-03-23T16:53:16Z","updated_at":"2018-03-23T16:53:16Z","author_association":"OWNER","body":"> I would like to execute it this way because at the time of the beginning the transaction all the queries that I would like to run within that transaction are not known yet.\r\n\r\nSo here's the misunderstanding: The callback returns a promise, so you can chain any dynamic context into it.\r\n\r\n"}}
{"actor":{"display_login":"vitaly-t"}}