generator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseCodeTemplate = errors.New("parse code template")
	ErrParseTestTemplate = errors.New("parse test template")
	ErrParseBaseTemplate = errors.New("parse base template")
	ErrWriteTestFile     = errors.New("write test file")
)

Functions

This section is empty.

Types

type CodeGenerator

type CodeGenerator struct {
	EnumsPkgName string
	// contains filtered or unexported fields
}

func NewCodeGenerator

func NewCodeGenerator() (*CodeGenerator, error)

NewCodeGenerator initializes and returns a new CodeGenerator with parsed templates

func (*CodeGenerator) GenerateCode

func (cg *CodeGenerator) GenerateCode(pkg string, name string, consts []string) ([]byte, error)

GenerateCode generates the enum code based on the provided package name, type name, and constants

func (*CodeGenerator) GenerateTests

func (cg *CodeGenerator) GenerateTests(
	pkg string,
	pkgDir string,
	importPath string,
	name string,
	consts []string,
) error

GenerateTests generates test code for the enum type and writes it to a file

Jump to

Keyboard shortcuts

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