git.sr.ht/~sircmpwn/gqlgen@v0.0.0-20200522192042-c84d29a1c940/plugin/plugin.go (about) 1 // plugin package interfaces are EXPERIMENTAL. 2 3 package plugin 4 5 import ( 6 "git.sr.ht/~sircmpwn/gqlgen/codegen" 7 "git.sr.ht/~sircmpwn/gqlgen/codegen/config" 8 "github.com/vektah/gqlparser/v2/ast" 9 ) 10 11 type Plugin interface { 12 Name() string 13 } 14 15 type ConfigMutator interface { 16 MutateConfig(cfg *config.Config) error 17 } 18 19 type CodeGenerator interface { 20 GenerateCode(cfg *codegen.Data) error 21 } 22 23 // EarlySourceInjector is used to inject things that are required for user schema files to compile. 24 type EarlySourceInjector interface { 25 InjectSourceEarly() *ast.Source 26 } 27 28 // LateSourceInjector is used to inject more sources, after we have loaded the users schema. 29 type LateSourceInjector interface { 30 InjectSourceLate(schema *ast.Schema) *ast.Source 31 }