Transactional Mutations

    Clone the code (optional)

    The code for this tutorial is available under github.com/a8m/ent-graphql-example, and tagged (using Git) in each step. If you want to skip the basic setup and start with the initial version of the GraphQL server, you can clone the repository and checkout as follows:

    cmd/todo/main.go

    1. Then, in the GraphQL mutations, use the client from context as follows:

    Isolation Levels

    If you’d like to tweak the transaction’s isolation level, you can do so by implementing your own TxOpener. For example:


    Great! With a few lines of code, our application now supports automatic transactional mutations. Please continue to the next section where we explain how to extend the Ent code generator and generate for our GraphQL mutations.