generator

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectImports added in v0.0.6

func CollectImports(f *ast.File) []*ast.ImportSpec

func CreateOutputDir added in v0.0.6

func CreateOutputDir(dir string) error

func CreateOutputFile added in v0.0.6

func CreateOutputFile(dir string, f *jen.File) error

func ExtractTypeInfo added in v0.6.0

func ExtractTypeInfo(expr ast.Expr) (paramType, importPath, typePkg string)

func FormatFuncType added in v0.6.0

func FormatFuncType(fType *ast.FuncType) string

func ParseType added in v0.10.1

func ParseType(typ string) *jen.Statement

func Render added in v0.10.2

func Render(b []byte, w io.Writer) error

Types

type BaseGenerator

type BaseGenerator struct {
	Writer    io.Writer
	ToWritter bool
	Name      string
}

BaseGenerator provides common functionality for generators

func NewBaseGenerator

func NewBaseGenerator(n string, w io.Writer, t bool) *BaseGenerator

NewBaseGenerator creates a new base generator

type Generator

type Generator interface {
	// Generate generates code based on the provided options
	Generate(opts Options) error
}

Generator interface that all generators must implement

type Options

type Options struct {
	InputFile     string
	OutputFile    string
	PackageName   string
	StructName    string
	ExtensionFile string
}

Options defines common options for all generators

Jump to

Keyboard shortcuts

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