import "github.com/99designs/gqlgen/codegen/config"
binder.go config.go package.go resolver.go
var InterfaceType = types.NewInterfaceType(nil, nil)
type Binder struct { References []*TypeReference SawInvalid bool // contains filtered or unexported fields }
Binder connects graphql types to golang types using static analysis
func (b *Binder) PointerTo(ref *TypeReference) *TypeReference
func (b *Binder) PushRef(ret *TypeReference)
func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret *TypeReference, err error)
type Config struct { SchemaFilename StringList `yaml:"schema,omitempty"` Exec PackageConfig `yaml:"exec"` Model PackageConfig `yaml:"model,omitempty"` Federation PackageConfig `yaml:"federation,omitempty"` Resolver ResolverConfig `yaml:"resolver,omitempty"` AutoBind []string `yaml:"autobind"` Models TypeMap `yaml:"models,omitempty"` StructTag string `yaml:"struct_tag,omitempty"` Directives map[string]DirectiveConfig `yaml:"directives,omitempty"` OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"` SkipValidation bool `yaml:"skip_validation,omitempty"` Sources []*ast.Source `yaml:"-"` Packages *code.Packages `yaml:"-"` Schema *ast.Schema `yaml:"-"` // Deprecated use Federation instead. Will be removed next release Federated bool `yaml:"federated,omitempty"` }
DefaultConfig creates a copy of the default config
LoadConfig reads the gqlgen.yml config file
LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories walking up the tree. The closest config file will be returned.
LoadDefaultConfig loads the default config so that it is ready to be used
type PackageConfig struct { Filename string `yaml:"filename,omitempty"` Package string `yaml:"package,omitempty"` }
func (c *PackageConfig) Check() error
func (c *PackageConfig) Dir() string
func (c *PackageConfig) ImportPath() string
func (c *PackageConfig) IsDefined() bool
func (c *PackageConfig) Pkg() *types.Package
type ResolverConfig struct { Filename string `yaml:"filename,omitempty"` FilenameTemplate string `yaml:"filename_template,omitempty"` Package string `yaml:"package,omitempty"` Type string `yaml:"type,omitempty"` Layout ResolverLayout `yaml:"layout,omitempty"` DirName string `yaml:"dir"` }
func (r *ResolverConfig) Check() error
func (r *ResolverConfig) Dir() string
func (r *ResolverConfig) ImportPath() string
func (r *ResolverConfig) IsDefined() bool
func (r *ResolverConfig) Pkg() *types.Package
var ( LayoutSingleFile ResolverLayout = "single-file" LayoutFollowSchema ResolverLayout = "follow-schema" )
func (a StringList) Has(file string) bool
func (a *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error
type TypeMap map[string]TypeMapEntry
type TypeMapEntry struct { Model StringList `yaml:"model"` Fields map[string]TypeMapField `yaml:"fields,omitempty"` }
type TypeMapField struct { Resolver bool `yaml:"resolver"` FieldName string `yaml:"fieldName"` GeneratedMethod string `yaml:"-"` }
type TypeReference struct { Definition *ast.Definition GQL *ast.Type GO types.Type // Type of the field being bound. Could be a pointer or a value type of Target. Target types.Type // The actual type that we know how to bind to. May require pointer juggling when traversing to fields. CastType types.Type // Before calling marshalling functions cast from/to this base type Marshaler *types.Func // When using external marshalling functions this will point to the Marshal function Unmarshaler *types.Func // When using external marshalling functions this will point to the Unmarshal function IsMarshaler bool // Does the type implement graphql.Marshaler and graphql.Unmarshaler }
TypeReference is used by args and field types. The Definition can refer to both input and output types.
func (ref *TypeReference) Elem() *TypeReference
func (t *TypeReference) IsNamed() bool
func (t *TypeReference) IsNilable() bool
func (t *TypeReference) IsPtr() bool
func (t *TypeReference) IsScalar() bool
func (t *TypeReference) IsSlice() bool
func (t *TypeReference) IsStruct() bool
func (t *TypeReference) IsTargetNilable() bool
func (t *TypeReference) MarshalFunc() string
func (t *TypeReference) UniquenessKey() string
func (t *TypeReference) UnmarshalFunc() string
Package config imports 15 packages (graph) and is imported by 73 packages. Updated 2020-08-22. Refresh now. Tools for package owners.