lang

package
v0.10.303 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateGoMethodMutationsForPackage added in v0.2.4

func GenerateGoMethodMutationsForPackage(s *schema.Schema, genConfig *config.GeneratorConfig, pkgConfig *config.PackageConfig) (*[]GoMethod, error)

GenerateGoMethodMutationsForPackage uses the provided configuration to generate the GoMethod structs that contain the information about performing GraphQL mutations.

func GenerateGoMethodQueriesForPackage added in v0.2.4

func GenerateGoMethodQueriesForPackage(s *schema.Schema, genConfig *config.GeneratorConfig, pkgConfig *config.PackageConfig) (*[]GoMethod, error)

GenerateGoMethodQueriesForPackage uses the provided configuration to generate the GoMethod structs that contain the information about performing GraphQL queries.

func GenerateGoTypesForPackage

func GenerateGoTypesForPackage(s *schema.Schema, genConfig *config.GeneratorConfig, pkgConfig *config.PackageConfig, expandedTypes *[]*schema.Type) (*[]GoStruct, *[]GoEnum, *[]GoScalar, *[]GoInterface, error)

Types

type Command added in v0.2.4

type Command struct {
	Name             string
	CmdVariableName  string
	ShortDescription string
	LongDescription  string
	Example          string
	InputType        string
	ClientMethod     string
	ClientMethodArgs []string
	InputObjects     []InputObject
	Flags            []CommandFlag
	Subcommands      []Command

	GraphQLPath []string // Should mutations also use this? Probably
}

type CommandExampleData added in v0.3.0

type CommandExampleData struct {
	CLIName     string
	PackageName string
	Command     string
	Subcommand  string
	Flags       []CommandFlag
}

type CommandFlag added in v0.2.4

type CommandFlag struct {
	Name           string
	Type           string
	FlagMethodName string
	DefaultValue   string
	Description    string
	VariableName   string
	VariableType   string
	ClientType     string
	Required       bool
	IsInputType    bool
	IsEnumType     bool
}

type CommandGenerator added in v0.2.4

type CommandGenerator struct {
	PackageName string
	Imports     []string
	Commands    []Command
}

TODO: Move CommandGenerator and its friends to a proper home

type GoEnum

type GoEnum struct {
	Name        string
	Description string
	Values      []GoEnumValue
}

type GoEnumValue

type GoEnumValue struct {
	Name        string
	Description string
}

type GoInterface

type GoInterface struct {
	Name          string
	Description   string
	Type          string
	PossibleTypes []GoInterfacePossibleType
	Methods       []string
}

type GoInterfacePossibleType added in v0.2.5

type GoInterfacePossibleType struct {
	GoName      string
	GraphQLName string
}

type GoMethod added in v0.2.0

type GoMethod struct {
	Description string
	Name        string
	QueryVars   []QueryVar
	Signature   GoMethodSignature
	QueryString string
	// ResponseObjectType is the name of the type for the API response.  Note that this is not the method return, but the API call response.
	ResponseObjectType string
}

type GoMethodInputType added in v0.2.0

type GoMethodInputType struct {
	Name string
	Type string
}

type GoMethodSignature added in v0.2.0

type GoMethodSignature struct {
	Input  []GoMethodInputType
	Return []string
	// ReturnSlice indicates if the response is a slice of objects or not.  Used to flag KindList.
	ReturnSlice bool
	// Return path is the fields on the response object that nest the results the given method will return.
	ReturnPath []string
}

type GoScalar

type GoScalar struct {
	Name        string
	Description string
	Type        string
}

type GoStruct

type GoStruct struct {
	Name             string
	Description      string
	Fields           []GoStructField
	StructTags       []string
	Implements       []string
	SpecialUnmarshal bool
	GenerateGetters  bool
}

type GoStructField

type GoStructField struct {
	Name        string
	Type        string
	TypeName    string
	Tags        string
	TagKey      string
	Description string
	IsInterface bool
	IsList      bool
}

type GolangGenerator

type GolangGenerator struct {
	Types       []GoStruct
	PackageName string
	Enums       []GoEnum
	Imports     []string
	Scalars     []GoScalar
	Interfaces  []GoInterface
	Mutations   []GoMethod
	Queries     []GoMethod
}

GolangGenerator is enough information to generate Go code for a single package.

type InputObject added in v0.3.0

type InputObject struct {
	Name   string
	GoType string
}

type QueryVar added in v0.2.0

type QueryVar struct {
	Key   string
	Value string
	Type  string
}

Jump to

Keyboard shortcuts

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