generate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyCasing

func ApplyCasing(s string, algo CasingAlgorithm, forceUpperFirst bool) string

ApplyCasing applies a specific casing algorithm to a string. It handles the different casing transformations based on the algorithm. The forceUpperFirst flag is used to make the first character uppercase regardless of the algorithm.

func Generate

func Generate(config *Config) (map[string][]byte, error)

Generate renders every configured output from one shared generation plan.

Types

type Casing

type Casing struct {
	Default  CasingAlgorithm
	AllEnums CasingAlgorithm
	Enums    map[string]CasingAlgorithm
}

Casing configures GraphQL-to-Go name conversion.

type CasingAlgorithm

type CasingAlgorithm string

CasingAlgorithm represents a GraphQL-to-Go name conversion algorithm.

const (
	CasingDefault       CasingAlgorithm = "default"
	CasingRaw           CasingAlgorithm = "raw"
	CasingAutoCamelCase CasingAlgorithm = "auto_camel_case"
)

type Config

type Config struct {
	Schema                          StringList
	Operations                      StringList
	ConfigFile                      string
	Generated                       string
	TestHandlerGenerated            string
	TestHandlerTypes                TestHandlerTypeStrategy
	Package                         string
	ExportOperations                string
	ContextType                     string
	ClientGetter                    string
	Bindings                        map[string]*TypeBinding
	PackageBindings                 []*PackageBinding
	Casing                          Casing
	StructReferences                bool
	OmitUnreferencedImplementations *bool
	// contains filtered or unexported fields
}

Config contains the normalized settings used by the generator implementation.

func (*Config) GetDefaultCasingAlgorithm

func (c *Config) GetDefaultCasingAlgorithm() CasingAlgorithm

GetDefaultCasingAlgorithm returns the default casing algorithm for the config.

func (*Config) ValidateAndFillDefaults

func (c *Config) ValidateAndFillDefaults(baseDir string) error

ValidateAndFillDefaults ensures that the configuration is valid, and fills in any options that were unspecified.

The argument is the directory relative to which paths will be interpreted, typically the directory of the config file.

type PackageBinding

type PackageBinding struct {
	Package string
}

A PackageBinding represents a Go package whose exported types become bindings.

type StringList

type StringList []string

StringList is a list of schema or operation path patterns.

type TestHandlerTypeStrategy

type TestHandlerTypeStrategy string

TestHandlerTypeStrategy controls where generated test handlers get operation types.

const (
	TestHandlerTypesClient TestHandlerTypeStrategy = "client"
	TestHandlerTypesLocal  TestHandlerTypeStrategy = "local"
)

type TypeBinding

type TypeBinding struct {
	Type              string
	ExpectExactFields string
	Marshaler         string
	Unmarshaler       string
}

A TypeBinding represents a Go type to which octoqlgen binds a GraphQL type.

Jump to

Keyboard shortcuts

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