clientgen

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadQuerySources

func LoadQuerySources(queryFileNames []string) ([]*ast.Source, error)

LoadQuerySourceなどは、gqlgenがLoadConfigでSchemaを読み込む時の実装をコピーして一部修正している **/test/*.graphqlなどに対応している

func ParseQueryDocuments

func ParseQueryDocuments(schema *ast.Schema, querySources []*ast.Source) (*ast.QueryDocument, error)

func QueryDocumentsByOperations

func QueryDocumentsByOperations(schema *ast.Schema, operations ast.OperationList) ([]*ast.QueryDocument, error)

func RenderTemplate

func RenderTemplate(cfg *config.Config, types []*Type, operations []*Operation, operationResponses []*OperationResponse, generateClient bool, client config.PackageConfig) error

Types

type Argument

type Argument struct {
	Variable string
	Type     types.Type
}

type Operation

type Operation struct {
	Name                string
	ResponseType        types.Type
	Operation           string
	OperationType       string
	Args                []*Argument
	VariableDefinitions ast.VariableDefinitionList
}

func NewOperation

func NewOperation(operation *OperationResponse, queryDocument *ast.QueryDocument, args []*Argument) *Operation

type OperationResponse

type OperationResponse struct {
	Operation *ast.OperationDefinition
	Name      string
	Type      types.Type
}

type Plugin

type Plugin struct {
	Client         config.PackageConfig
	GenerateConfig *gqlgencConfig.GenerateConfig
	// contains filtered or unexported fields
}

func New

func New(queryFilePaths []string, client config.PackageConfig, generateConfig *gqlgencConfig.GenerateConfig) *Plugin

func (*Plugin) MutateConfig

func (p *Plugin) MutateConfig(cfg *config.Config) error

func (*Plugin) Name

func (p *Plugin) Name() string

type ResponseField

type ResponseField struct {
	Name             string
	IsFragmentSpread bool
	IsInlineFragment bool
	Type             types.Type
	Tags             []string
	ResponseFields   ResponseFieldList
}

type ResponseFieldList

type ResponseFieldList []*ResponseField

func (ResponseFieldList) IsBasicType

func (rs ResponseFieldList) IsBasicType() bool

func (ResponseFieldList) IsFragment

func (rs ResponseFieldList) IsFragment() bool

func (ResponseFieldList) IsStructType

func (rs ResponseFieldList) IsStructType() bool

type Source

type Source struct {
	// contains filtered or unexported fields
}

func NewSource

func NewSource(schema *ast.Schema, queryDocument *ast.QueryDocument, sourceGenerator *SourceGenerator, generateConfig *config.GenerateConfig) *Source

func (*Source) Fragments

func (s *Source) Fragments() error

func (*Source) OperationResponses

func (s *Source) OperationResponses() ([]*OperationResponse, error)

func (*Source) Operations

func (s *Source) Operations(queryDocuments []*ast.QueryDocument, operationResponses []*OperationResponse) []*Operation

type SourceGenerator

type SourceGenerator struct {
	// contains filtered or unexported fields
}

func NewSourceGenerator

func NewSourceGenerator(cfg *config.Config, client config.PackageConfig) *SourceGenerator

func (*SourceGenerator) GenTypes

func (r *SourceGenerator) GenTypes() []*Type

func (*SourceGenerator) GetGenType

func (r *SourceGenerator) GetGenType(name string) *Type

func (*SourceGenerator) NewResponseField

func (r *SourceGenerator) NewResponseField(prefix string, selection ast.Selection) *ResponseField

func (*SourceGenerator) NewResponseFields

func (r *SourceGenerator) NewResponseFields(prefix string, selectionSet *ast.SelectionSet) ResponseFieldList

func (*SourceGenerator) OperationArguments

func (r *SourceGenerator) OperationArguments(variableDefinitions ast.VariableDefinitionList) []*Argument

func (*SourceGenerator) RegisterGenType

func (r *SourceGenerator) RegisterGenType(name string, typ *Type)

func (*SourceGenerator) Type

func (r *SourceGenerator) Type(typeName string) types.Type

Typeの引数に渡すtypeNameは解析した結果からselectionなどから求めた型の名前を渡さなければいけない

type Type

type Type struct {
	Name           string
	Type           types.Type
	UnmarshalTypes map[string]TypeTarget
	RefType        *types.Named
}

type TypeTarget

type TypeTarget struct {
	Type types.Type
	Name string
}

Jump to

Keyboard shortcuts

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