doc/graphql: change mutation-input example to extension

This commit is contained in:
Ariel Mashraki
2021-07-10 14:48:25 +03:00
committed by Ariel Mashraki
parent ac9f801259
commit 095ef5b4e6
2 changed files with 13 additions and 6 deletions

View File

@@ -81,13 +81,17 @@ The full documentation for the template API (Go types and functions) is availabl
Now, we tell the Ent code generator to execute this template by passing it as an argument in the `ent/entc.go` file:
```diff
```go {8}
func main() {
err := entc.Generate("./schema", &gen.Config{
Templates: entgql.AllTemplates,
- })
+ }, entc.TemplateDir("./template"))
ex, err := entgql.NewExtension()
if err != nil {
log.Fatalf("creating entgql extension: %v", err)
}
opts := []entc.Option{
entc.Extensions(ex),
entc.TemplateDir("./template"),
}
if err := entc.Generate("./schema", &gen.Config{}, opts...); err != nil {
log.Fatalf("running ent codegen: %v", err)
}
}