gqlgen: github.com/99designs/gqlgen/codegen/config Index | Files

package config

import "github.com/99designs/gqlgen/codegen/config"

Index

Package Files

binder.go config.go package.go resolver.go

Variables

var InterfaceType = types.NewInterfaceType(nil, nil)
var MapType = types.NewMap(types.Typ[types.String], types.NewInterfaceType(nil, nil).Complete())

func IsNilable Uses

func IsNilable(t types.Type) bool

type Binder Uses

type Binder struct {
    References []*TypeReference
    SawInvalid bool
    // contains filtered or unexported fields
}

Binder connects graphql types to golang types using static analysis

func (*Binder) CopyModifiersFromAst Uses

func (b *Binder) CopyModifiersFromAst(t *ast.Type, base types.Type) types.Type

func (*Binder) DefaultUserObject Uses

func (b *Binder) DefaultUserObject(name string) (types.Type, error)

func (*Binder) FindObject Uses

func (b *Binder) FindObject(pkgName string, typeName string) (types.Object, error)

func (*Binder) FindType Uses

func (b *Binder) FindType(pkgName string, typeName string) (types.Type, error)

func (*Binder) FindTypeFromName Uses

func (b *Binder) FindTypeFromName(name string) (types.Type, error)

func (*Binder) ObjectPosition Uses

func (b *Binder) ObjectPosition(typ types.Object) token.Position

func (*Binder) PointerTo Uses

func (b *Binder) PointerTo(ref *TypeReference) *TypeReference

func (*Binder) PushRef Uses

func (b *Binder) PushRef(ret *TypeReference)

func (*Binder) TypePosition Uses

func (b *Binder) TypePosition(typ types.Type) token.Position

func (*Binder) TypeReference Uses

func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret *TypeReference, err error)

type Config Uses

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"`
}

func DefaultConfig Uses

func DefaultConfig() *Config

DefaultConfig creates a copy of the default config

func LoadConfig Uses

func LoadConfig(filename string) (*Config, error)

LoadConfig reads the gqlgen.yml config file

func LoadConfigFromDefaultLocations Uses

func LoadConfigFromDefaultLocations() (*Config, error)

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.

func (*Config) Init Uses

func (c *Config) Init() error

func (*Config) LoadSchema Uses

func (c *Config) LoadSchema() error

func (*Config) NewBinder Uses

func (c *Config) NewBinder() *Binder

type DirectiveConfig Uses

type DirectiveConfig struct {
    SkipRuntime bool `yaml:"skip_runtime"`
}

type PackageConfig Uses

type PackageConfig struct {
    Filename string `yaml:"filename,omitempty"`
    Package  string `yaml:"package,omitempty"`
}

func (*PackageConfig) Check Uses

func (c *PackageConfig) Check() error

func (*PackageConfig) Dir Uses

func (c *PackageConfig) Dir() string

func (*PackageConfig) ImportPath Uses

func (c *PackageConfig) ImportPath() string

func (*PackageConfig) IsDefined Uses

func (c *PackageConfig) IsDefined() bool

func (*PackageConfig) Pkg Uses

func (c *PackageConfig) Pkg() *types.Package

type ResolverConfig Uses

type ResolverConfig struct {
    Filename string         `yaml:"filename,omitempty"`
    Package  string         `yaml:"package,omitempty"`
    Type     string         `yaml:"type,omitempty"`
    Layout   ResolverLayout `yaml:"layout,omitempty"`
    DirName  string         `yaml:"dir"`
}

func (*ResolverConfig) Check Uses

func (r *ResolverConfig) Check() error

func (*ResolverConfig) Dir Uses

func (r *ResolverConfig) Dir() string

func (*ResolverConfig) ImportPath Uses

func (r *ResolverConfig) ImportPath() string

func (*ResolverConfig) IsDefined Uses

func (r *ResolverConfig) IsDefined() bool

func (*ResolverConfig) Pkg Uses

func (r *ResolverConfig) Pkg() *types.Package

type ResolverLayout Uses

type ResolverLayout string
var (
    LayoutSingleFile   ResolverLayout = "single-file"
    LayoutFollowSchema ResolverLayout = "follow-schema"
)

type StringList Uses

type StringList []string

func (StringList) Has Uses

func (a StringList) Has(file string) bool

func (*StringList) UnmarshalYAML Uses

func (a *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error

type TypeMap Uses

type TypeMap map[string]TypeMapEntry

func (TypeMap) Add Uses

func (tm TypeMap) Add(name string, goType string)

func (TypeMap) Check Uses

func (tm TypeMap) Check() error

func (TypeMap) Exists Uses

func (tm TypeMap) Exists(typeName string) bool

func (TypeMap) ReferencedPackages Uses

func (tm TypeMap) ReferencedPackages() []string

func (TypeMap) UserDefined Uses

func (tm TypeMap) UserDefined(typeName string) bool

type TypeMapEntry Uses

type TypeMapEntry struct {
    Model  StringList              `yaml:"model"`
    Fields map[string]TypeMapField `yaml:"fields,omitempty"`
}

type TypeMapField Uses

type TypeMapField struct {
    Resolver        bool   `yaml:"resolver"`
    FieldName       string `yaml:"fieldName"`
    GeneratedMethod string `yaml:"-"`
}

type TypeReference Uses

type TypeReference struct {
    Definition  *ast.Definition
    GQL         *ast.Type
    GO          types.Type
    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 (*TypeReference) Elem Uses

func (ref *TypeReference) Elem() *TypeReference

func (*TypeReference) IsNamed Uses

func (t *TypeReference) IsNamed() bool

func (*TypeReference) IsNilable Uses

func (t *TypeReference) IsNilable() bool

func (*TypeReference) IsPtr Uses

func (t *TypeReference) IsPtr() bool

func (*TypeReference) IsScalar Uses

func (t *TypeReference) IsScalar() bool

func (*TypeReference) IsSlice Uses

func (t *TypeReference) IsSlice() bool

func (*TypeReference) IsStruct Uses

func (t *TypeReference) IsStruct() bool

func (*TypeReference) MarshalFunc Uses

func (t *TypeReference) MarshalFunc() string

func (*TypeReference) UniquenessKey Uses

func (t *TypeReference) UniquenessKey() string

func (*TypeReference) UnmarshalFunc Uses

func (t *TypeReference) UnmarshalFunc() string

Package config imports 15 packages (graph) and is imported by 50 packages. Updated 2020-02-22. Refresh now. Tools for package owners.