-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
plugin.go
37 lines (28 loc) · 888 Bytes
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// plugin package interfaces are EXPERIMENTAL.
package plugin
import (
"github.com/vektah/gqlparser/v2/ast"
"github.com/99designs/gqlgen/codegen"
"github.com/99designs/gqlgen/codegen/config"
)
type Plugin interface {
Name() string
}
type ConfigMutator interface {
MutateConfig(cfg *config.Config) error
}
type CodeGenerator interface {
GenerateCode(cfg *codegen.Data) error
}
// EarlySourceInjector is used to inject things that are required for user schema files to compile.
type EarlySourceInjector interface {
InjectSourceEarly() *ast.Source
}
// LateSourceInjector is used to inject more sources, after we have loaded the users schema.
type LateSourceInjector interface {
InjectSourceLate(schema *ast.Schema) *ast.Source
}
// ResolverImplementer is used to generate code inside resolvers
type ResolverImplementer interface {
Implement(field *codegen.Field) string
}