Documentation
¶
Index ¶
- func Generate(cfg Config) error
- func GenerateServer(cfg Config, filename string) error
- type BindError
- type BindErrors
- type Build
- type Config
- type Directive
- type Enum
- type EnumValue
- type Field
- func (f *Field) ArgsFunc() string
- func (f *Field) CallArgs() string
- func (f *Field) ComplexityArgs() string
- func (f *Field) ComplexitySignature() string
- func (f *Field) GoNameExported() string
- func (f *Field) GoNameUnexported() string
- func (f *Field) IsConcurrent() bool
- func (f *Field) IsMethod() bool
- func (f *Field) IsReserved() bool
- func (f *Field) IsResolver() bool
- func (f *Field) IsVariable() bool
- func (f *Field) ResolverDeclaration() string
- func (f *Field) ResolverType() string
- func (f *Field) ShortInvocation() string
- func (f *Field) ShortResolverDeclaration() string
- func (f *Field) WriteJson() string
- type FieldArgument
- type GoFieldType
- type Interface
- type InterfaceImplementor
- type Model
- type ModelBuild
- type ModelField
- type NamedType
- type NamedTypes
- type Object
- type Objects
- type PackageConfig
- type Ref
- type ResolverBuild
- type SchemaFilenames
- type ServerBuild
- type Type
- type TypeMap
- type TypeMapEntry
- type TypeMapField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateServer ¶
Types ¶
type BindErrors ¶
type BindErrors []BindError
func (BindErrors) Error ¶
func (b BindErrors) Error() string
type Config ¶
type Config struct {
SchemaFilename SchemaFilenames `yaml:"schema,omitempty"`
SchemaStr map[string]string `yaml:"-"`
Exec PackageConfig `yaml:"exec"`
Model PackageConfig `yaml:"model"`
Resolver PackageConfig `yaml:"resolver,omitempty"`
Models TypeMap `yaml:"models,omitempty"`
StructTag string `yaml:"struct_tag,omitempty"`
FilePath string `yaml:"-"`
// contains filtered or unexported fields
}
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig creates a copy of the default config
func LoadConfig ¶
LoadConfig reads the gqlgen.yml config file
func LoadConfigFromDefaultLocations ¶
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.
type Directive ¶
type Directive struct {
Name string
Args []FieldArgument
}
func (*Directive) Declaration ¶
type Field ¶
type Field struct {
*Type
Description string // Description of a field
GQLName string // The name of the field in graphql
GoFieldType GoFieldType // The field type in go, if any
GoReceiverName string // The name of method & var receiver in go, if any
GoFieldName string // The name of the method or var in go, if any
Args []FieldArgument // A list of arguments to be passed to this field
ForceResolver bool // Should be emit Resolver method
MethodHasContext bool // If this is bound to a go method, does the method also take a context
NoErr bool // If this is bound to a go method, does that method have an error as the second argument
Object *Object // A link back to the parent object
Default interface{} // The default value
}
func (*Field) ComplexityArgs ¶ added in v0.5.0
func (*Field) ComplexitySignature ¶ added in v0.5.0
func (*Field) GoNameExported ¶
func (*Field) GoNameUnexported ¶
func (*Field) IsConcurrent ¶
func (*Field) IsReserved ¶ added in v0.5.0
func (*Field) IsResolver ¶
func (*Field) IsVariable ¶
func (*Field) ResolverDeclaration ¶
func (*Field) ResolverType ¶
func (*Field) ShortInvocation ¶
func (*Field) ShortResolverDeclaration ¶
type FieldArgument ¶
type FieldArgument struct {
*Type
GQLName string // The name of the argument in graphql
GoVarName string // The name of the var in go
Object *Object // A link back to the parent object
Default interface{} // The default value
}
func (*FieldArgument) Stream ¶
func (f *FieldArgument) Stream() bool
type GoFieldType ¶
type GoFieldType int
const ( GoFieldUndefined GoFieldType = iota GoFieldMethod GoFieldVariable )
type Interface ¶
type Interface struct {
*NamedType
Implementors []InterfaceImplementor
}
type InterfaceImplementor ¶
type Model ¶
type Model struct {
*NamedType
Description string
Fields []ModelField
Implements []*NamedType
}
type ModelBuild ¶
type ModelField ¶
type NamedType ¶
type NamedType struct {
Ref
IsScalar bool
IsInterface bool
IsInput bool
GQLType string // Name of the graphql type
Marshaler *Ref // If this type has an external marshaler this will be set
}
func (NamedType) IsMarshaled ¶
type NamedTypes ¶
type Object ¶
type Object struct {
*NamedType
Fields []Field
Satisfies []string
Implements []*NamedType
ResolverInterface *Ref
Root bool
DisableConcurrency bool
Stream bool
}
func (*Object) HasResolvers ¶
func (*Object) Implementors ¶
func (*Object) IsConcurrent ¶ added in v0.5.0
func (*Object) IsReserved ¶ added in v0.5.0
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
type Ref ¶
type ResolverBuild ¶
type SchemaFilenames ¶ added in v0.7.0
type SchemaFilenames []string
func (SchemaFilenames) Has ¶ added in v0.7.0
func (a SchemaFilenames) Has(file string) bool
func (*SchemaFilenames) UnmarshalYAML ¶ added in v0.7.0
func (a *SchemaFilenames) UnmarshalYAML(unmarshal func(interface{}) error) error
type ServerBuild ¶
type Type ¶
func (Type) FullSignature ¶
type TypeMap ¶
type TypeMap map[string]TypeMapEntry
type TypeMapEntry ¶
type TypeMapEntry struct {
Model string `yaml:"model"`
Fields map[string]TypeMapField `yaml:"fields,omitempty"`
}
type TypeMapField ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.