config

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InterfaceType = types.NewInterfaceType(nil, nil)

Functions

This section is empty.

Types

type Binder

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

Binder connects graphql types to golang types using static analysis

func (*Binder) CopyModifiersFromAst

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

func (*Binder) DefaultUserObject

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

func (*Binder) FindObject

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

func (*Binder) FindType

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

func (*Binder) ObjectPosition

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

func (*Binder) PointerTo

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

func (*Binder) PushRef

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

func (*Binder) TypePosition

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

func (*Binder) TypeReference

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

type Config

type Config struct {
	SchemaFilename StringList    `yaml:"schema,omitempty"`
	Exec           PackageConfig `yaml:"exec"`
	Model          PackageConfig `yaml:"model"`
	Resolver       PackageConfig `yaml:"resolver,omitempty"`
	Models         TypeMap       `yaml:"models,omitempty"`
	StructTag      string        `yaml:"struct_tag,omitempty"`
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig creates a copy of the default config

func LoadConfig

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

LoadConfig reads the gqlgen.yml config file

func LoadConfigFromDefaultLocations

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) Check

func (c *Config) Check() error

func (*Config) InjectBuiltins

func (c *Config) InjectBuiltins(s *ast.Schema)

func (*Config) LoadSchema

func (c *Config) LoadSchema() (*ast.Schema, map[string]string, error)

func (*Config) NewBinder

func (c *Config) NewBinder(s *ast.Schema) (*Binder, error)

type PackageConfig

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

func (*PackageConfig) Check

func (c *PackageConfig) Check() error

func (*PackageConfig) Dir

func (c *PackageConfig) Dir() string

func (*PackageConfig) ImportPath

func (c *PackageConfig) ImportPath() string

func (*PackageConfig) IsDefined

func (c *PackageConfig) IsDefined() bool

func (*PackageConfig) Pkg

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

type StringList

type StringList []string

func (StringList) Has

func (a StringList) Has(file string) bool

func (*StringList) UnmarshalYAML

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

type TypeMap

type TypeMap map[string]TypeMapEntry

func (TypeMap) Add

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

func (TypeMap) Check

func (tm TypeMap) Check() error

func (TypeMap) Exists

func (tm TypeMap) Exists(typeName string) bool

func (TypeMap) ReferencedPackages

func (tm TypeMap) ReferencedPackages() []string

func (TypeMap) UserDefined

func (tm TypeMap) UserDefined(typeName string) bool

type TypeMapEntry

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

type TypeMapField

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

type TypeReference

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

TypeReference is used by args and field types. The Definition can refer to both input and output types.

func (*TypeReference) Elem

func (ref *TypeReference) Elem() *TypeReference

func (*TypeReference) HasIsZero

func (t *TypeReference) HasIsZero() bool

func (*TypeReference) IsNamed

func (t *TypeReference) IsNamed() bool

func (*TypeReference) IsPtr

func (t *TypeReference) IsPtr() bool

func (*TypeReference) IsScalar

func (t *TypeReference) IsScalar() bool

func (*TypeReference) IsSlice

func (t *TypeReference) IsSlice() bool

func (*TypeReference) IsStruct

func (t *TypeReference) IsStruct() bool

func (*TypeReference) MarshalFunc

func (t *TypeReference) MarshalFunc() string

func (*TypeReference) SelfMarshalling

func (t *TypeReference) SelfMarshalling() bool

func (*TypeReference) SelfUnmarshalling

func (t *TypeReference) SelfUnmarshalling() bool

func (*TypeReference) UniquenessKey

func (t *TypeReference) UniquenessKey() string

func (*TypeReference) UnmarshalFunc

func (t *TypeReference) UnmarshalFunc() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL