clientgenv2

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 18 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUniqueName added in v0.0.3

func IsUniqueName(os ast.OperationList) error

func LoadQuerySources

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

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

func NewLayerTypeName added in v0.0.3

func NewLayerTypeName(base, thisField string) string

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, fragments []*Fragment, operations []*Operation, operationResponses []*OperationResponse, structSources []*StructSource, generateCfg *gqlgencConfig.GenerateConfig, client config.PackageConfig) error

func ValidateOperationList added in v0.0.3

func ValidateOperationList(os ast.OperationList) error

Types

type Argument

type Argument struct {
	Variable string
	Type     types.Type
}

type Fragment

type Fragment struct {
	Name string
	Type types.Type
}

type GenGettersGenerator added in v0.13.4

type GenGettersGenerator struct {
	ClientPackageName string
}

func (*GenGettersGenerator) GenFunc added in v0.13.4

func (g *GenGettersGenerator) GenFunc() func(name string, p types.Type) string

type Operation

type Operation struct {
	Name                string
	ResponseStructName  string
	Operation           string
	Args                []*Argument
	VariableDefinitions ast.VariableDefinitionList
}

func NewOperation

func NewOperation(operation *ast.OperationDefinition, queryDocument *ast.QueryDocument, args []*Argument, generateConfig *config.GenerateConfig) *Operation

type OperationResponse

type OperationResponse struct {
	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) IsFragmentSpread added in v0.0.4

func (rs ResponseFieldList) IsFragmentSpread() bool

func (ResponseFieldList) IsStructType

func (rs ResponseFieldList) IsStructType() bool

func (ResponseFieldList) StructType

func (rs ResponseFieldList) StructType() *types.Struct

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() ([]*Fragment, error)

func (*Source) OperationResponses

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

func (*Source) Operations

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

func (*Source) ResponseSubTypes added in v0.0.3

func (s *Source) ResponseSubTypes() []*StructSource

type SourceGenerator

type SourceGenerator struct {
	StructSources []*StructSource
	// contains filtered or unexported fields
}

func NewSourceGenerator

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

func (*SourceGenerator) NewResponseField

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

func (*SourceGenerator) NewResponseFields

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

func (*SourceGenerator) NewResponseFieldsByDefinition

func (r *SourceGenerator) NewResponseFieldsByDefinition(definition *ast.Definition) (ResponseFieldList, error)

func (*SourceGenerator) OperationArguments

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

func (*SourceGenerator) Type

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

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

type StructSource added in v0.0.3

type StructSource struct {
	Name string
	Type types.Type
}

Jump to

Keyboard shortcuts

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