Created
December 10, 2021 05:08
-
-
Save manakuro/0f5fc126e0d414c1bb3e2e4010681c3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package repository | |
import ( | |
"context" | |
"golang-clean-architecture-ent-gqlgen/ent" | |
) | |
// WithTransactionalMutation automatically wrap the GraphQL mutations with a database transaction. | |
// This allows the ent.Client to commit at the end, or rollback the transaction in case of a GraphQL error. | |
func WithTransactionalMutation(ctx context.Context) *ent.Client { | |
return ent.FromContext(ctx) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment