how about let mutation operation has transaction ability automatically? #2310
Answered
by
giautm
bonafideyan
asked this question in
Q&A
-
What happened?nothing What did you expect?I can omit lots lines for transaction, such as db.rollback, db.commit |
Beta Was this translation helpful? Give feedback.
Answered by
giautm
Jul 30, 2022
Replies: 1 comment 2 replies
-
Hi @bonafideyan, because it depends on the Database driver / ORM that you used in your project. So, I think GQLGen can't do it automatically. However, you can apply the flowing pattern:
We (Ent/EntGQL) applied this pattern in our implementation. So, you can check out the example here for detail and here. This also can apply to the regular SQL driver: |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
frederikhors
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @bonafideyan, because it depends on the Database driver / ORM that you used in your project. So, I think GQLGen can't do it automatically. However, you can apply the flowing pattern:
We (Ent/EntGQL) applied this pattern in our implementation. So, you can check out the example here for detail and here. This also can apply to the regular SQL driver: