Documentation ¶
Index ¶
- func GenerateCode(data *Data) error
- type ArgSet
- type Data
- type Directive
- type DirectiveList
- 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) DirectiveObjName() string
- func (f *Field) GoNameUnexported() string
- func (f *Field) HasDirectives() bool
- func (f *Field) ImplDirectives() []*Directive
- func (f *Field) IsConcurrent() bool
- func (f *Field) IsMap() bool
- func (f *Field) IsMethod() bool
- func (f *Field) IsReserved() bool
- func (f *Field) IsVariable() bool
- func (f *Field) ResolverType() string
- func (f *Field) ShortInvocation() string
- func (f *Field) ShortResolverDeclaration() string
- type FieldArgument
- type GoFieldType
- type Interface
- type InterfaceImplementor
- type Object
- func (o *Object) Description() string
- func (o *Object) HasDirectives() bool
- func (o *Object) HasResolvers() bool
- func (o *Object) HasUnmarshal() bool
- func (o *Object) Implementors() string
- func (o *Object) IsConcurrent() bool
- func (o *Object) IsReserved() bool
- func (o *Object) Reference() types.Type
- func (o *Object) UniqueFields() map[string][]*Field
- type Objects
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCode ¶
Types ¶
type ArgSet ¶
type ArgSet struct { Args []*FieldArgument FuncDecl string }
type Data ¶
type Data struct { Config *config.Config Schema *ast.Schema SchemaStr map[string]string Directives DirectiveList Objects Objects Inputs Objects Interfaces map[string]*Interface ReferencedTypes map[string]*config.TypeReference ComplexityRoots map[string]*Object QueryRoot *Object MutationRoot *Object SubscriptionRoot *Object }
Data is a unified model of the code to be generated. Plugins may modify this structure to do things like implement resolvers or directives automatically (eg grpc, validation)
func (*Data) Args ¶
func (a *Data) Args() map[string][]*FieldArgument
type Directive ¶
type Directive struct { *ast.DirectiveDefinition Name string Args []*FieldArgument Builtin bool }
func (*Directive) Declaration ¶
func (*Directive) IsLocation ¶
func (d *Directive) IsLocation(location ...ast.DirectiveLocation) bool
IsLocation check location directive
type DirectiveList ¶
func (DirectiveList) LocationDirectives ¶
func (dl DirectiveList) LocationDirectives(location string) DirectiveList
LocationDirectives filter directives by location
type Field ¶
type Field struct { *ast.FieldDefinition TypeReference *config.TypeReference 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 IsResolver bool // Does this field need a resolver Args []*FieldArgument // A list of arguments to be passed to this field 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 Stream bool // does this field return a channel? Directives []*Directive }
func (*Field) ComplexityArgs ¶
func (*Field) ComplexitySignature ¶
func (*Field) DirectiveObjName ¶
func (*Field) GoNameUnexported ¶
func (*Field) HasDirectives ¶
func (*Field) ImplDirectives ¶
func (*Field) IsConcurrent ¶
func (*Field) IsReserved ¶
func (*Field) IsVariable ¶
func (*Field) ResolverType ¶
func (*Field) ShortInvocation ¶
func (*Field) ShortResolverDeclaration ¶
type FieldArgument ¶
type FieldArgument struct { *ast.ArgumentDefinition TypeReference *config.TypeReference VarName string // The name of the var in go Object *Object // A link back to the parent object Default interface{} // The default value Directives []*Directive Value interface{} // value set in Data }
func (*FieldArgument) DirectiveObjName ¶
func (f *FieldArgument) DirectiveObjName() string
func (*FieldArgument) ImplDirectives ¶
func (f *FieldArgument) ImplDirectives() []*Directive
ImplDirectives get not Builtin and location ARGUMENT_DEFINITION directive
func (*FieldArgument) Stream ¶
func (f *FieldArgument) Stream() bool
type GoFieldType ¶
type GoFieldType int
const ( GoFieldUndefined GoFieldType = iota GoFieldMethod GoFieldVariable GoFieldMap )
type Interface ¶
type Interface struct { *ast.Definition Type types.Type Implementors []InterfaceImplementor InTypemap bool }
type InterfaceImplementor ¶
type InterfaceImplementor struct { *ast.Definition Interface *Interface Type types.Type }
func (*InterfaceImplementor) ValueReceiver ¶
func (i *InterfaceImplementor) ValueReceiver() bool
type Object ¶
type Object struct { *ast.Definition Type types.Type ResolverInterface types.Type Root bool Fields []*Field Implements []*ast.Definition DisableConcurrency bool Stream bool Directives []*Directive }
func (*Object) Description ¶
func (*Object) HasDirectives ¶
func (*Object) HasResolvers ¶
func (*Object) HasUnmarshal ¶
func (*Object) Implementors ¶
func (*Object) IsConcurrent ¶
func (*Object) IsReserved ¶
func (*Object) UniqueFields ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.