codegen

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(g *Generator)

Main is the main function for a code generation command for a generator. It is a wrapper of multichecker.Main. See github.com/gqlgo/gqlanalysis/singlechecker.

func NewTemplate

func NewTemplate(pass *Pass, name string) *template.Template

func NewTemplateFuncs

func NewTemplateFuncs(tmpl *template.Template, pass *Pass) template.FuncMap

Types

type Generator

type Generator struct {
	Name     string
	Doc      string
	Flags    flag.FlagSet
	Run      func(*Pass) error
	Requires []*gqlanalysis.Analyzer
	Output   io.Writer
}

A Generator describes a code generator function and its options.

func (*Generator) ToAnalyzer

func (g *Generator) ToAnalyzer() *gqlanalysis.Analyzer

ToAnalyzer converts the generator to an analyzer.

type Pass

type Pass struct {
	Generator *Generator

	Schema   *ast.Schema
	Queries  []*ast.QueryDocument
	Comments []*gqlanalysis.Comment
	ResultOf map[*gqlanalysis.Analyzer]interface{}

	Output io.Writer
	// contains filtered or unexported fields
}

func (*Pass) Cleanup

func (pass *Pass) Cleanup(f func())

func (*Pass) CreateTemp

func (pass *Pass) CreateTemp(name string) (file io.ReadWriteSeeker, path string)

func (*Pass) TempDir

func (pass *Pass) TempDir() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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