doc/tutorial: add title with file names to code blocks (#2430)

This commit is contained in:
Ariel Mashraki
2022-03-26 18:49:04 +03:00
committed by GitHub
parent a89d1ec40f
commit cb7e0c1f1b
6 changed files with 27 additions and 27 deletions

View File

@@ -30,13 +30,13 @@ we follow these steps:
1\. Edit the `cmd/todo/main.go` and add to the GraphQL server initialization the `entgql.Transactioner` handler as
follows:
```diff
```diff title="cmd/todo/main.go"
srv := handler.NewDefaultServer(todo.NewSchema(client))
+srv.Use(entgql.Transactioner{TxOpener: client})
```
2\. Then, in the GraphQL mutations, use the client from context as follows:
```diff
```diff title="todo.resolvers.go"
func (mutationResolver) CreateTodo(ctx context.Context, todo TodoInput) (*ent.Todo, error) {
+ client := ent.FromContext(ctx)
+ return client.Todo.