codegen

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentInfo

type ComponentInfo struct {
	Package  string
	File     string
	Line     int
	TypeName string
	Kind     ComponentKind
}

ComponentInfo describes one struct embedding a Helix component marker.

type ComponentKind

type ComponentKind string

ComponentKind identifies the Helix marker embedded by a component struct.

const (
	// ComponentService marks a struct embedding helix.Service.
	ComponentService ComponentKind = "service"
	// ComponentController marks a struct embedding helix.Controller.
	ComponentController ComponentKind = "controller"
	// ComponentRepository marks a struct embedding helix.Repository.
	ComponentRepository ComponentKind = "repository"
	// ComponentComponent marks a struct embedding helix.Component.
	ComponentComponent ComponentKind = "component"
)

type DIGenerator

type DIGenerator struct {
	// contains filtered or unexported fields
}

DIGenerator creates compile-time dependency wiring for Helix components.

func NewDIGenerator

func NewDIGenerator(dir string) *DIGenerator

NewDIGenerator creates a DI wiring generator rooted at dir.

func (*DIGenerator) Generate

func (g *DIGenerator) Generate(ctx context.Context) error

Generate scans Helix components and writes helix_wire_gen.go when needed.

type DirectiveInfo

type DirectiveInfo struct {
	Package  string
	File     string
	Line     int
	Target   string
	Name     string
	Argument string
	Raw      string
}

DirectiveInfo describes one canonical Helix directive comment.

type ErrorHandlerDirective

type ErrorHandlerDirective struct {
	ErrorTypes     []string // Error type names
	MethodName     string   // Go method name
	ControllerName string   // Go type name of the handler
	LineNum        int      // Source line number for debugging
}

ErrorHandlerDirective represents a parsed //helix:handles directive.

type GenerateResult

type GenerateResult struct {
	Files []string
}

GenerateResult contains information about the generation process.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator creates repository query implementations for one directory tree.

func NewGenerator

func NewGenerator(dir string) *Generator

NewGenerator creates a repository query generator rooted at dir.

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context) (Result, error)

Generate scans the generator root and writes deterministic *_gen.go files.

type PackageInfo

type PackageInfo struct {
	Name string
	Dir  string
}

PackageInfo describes one parsed Go package.

type Result

type Result struct {
	GeneratedFiles int
}

Result describes the outcome of one generation run.

type RouteDirective

type RouteDirective struct {
	Method         string   // HTTP method (GET, POST, etc.)
	Path           string   // URL path
	MethodName     string   // Go method name
	ControllerName string   // Go type name of the controller
	Guards         []string // Names of guards to apply
	Interceptors   []string // Names of interceptors to apply
	LineNum        int      // Source line number for debugging
}

RouteDirective represents a parsed //helix:route directive.

type ScanResult

type ScanResult struct {
	Packages   []PackageInfo
	Components []ComponentInfo
	Directives []DirectiveInfo
}

ScanResult contains all metadata discovered in one scanner run.

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner reads Go source packages and extracts Helix code generation metadata.

func NewScanner

func NewScanner(dir string) *Scanner

NewScanner creates a source scanner rooted at dir.

func (*Scanner) Scan

func (s *Scanner) Scan(ctx context.Context) (ScanResult, error)

Scan parses the configured directory tree and returns Helix metadata.

type WebGenerator

type WebGenerator struct {
	// contains filtered or unexported fields
}

WebGenerator generates Go code for the web layer.

func NewWebGenerator

func NewWebGenerator(dir string) *WebGenerator

NewWebGenerator creates a new WebGenerator.

func (*WebGenerator) Generate

func (g *WebGenerator) Generate(ctx context.Context) (GenerateResult, error)

Generate scans for web directives and generates registration code.

type WebScanner

type WebScanner struct {
	// contains filtered or unexported fields
}

WebScanner scans Go source files for web layer directives.

func NewWebScanner

func NewWebScanner() *WebScanner

NewWebScanner creates a new WebScanner.

func (*WebScanner) ScanControllerDirectives

func (ws *WebScanner) ScanControllerDirectives(filename string) ([]RouteDirective, error)

ScanControllerDirectives finds all web directives in a source file.

func (*WebScanner) ScanErrorHandlerDirectives

func (ws *WebScanner) ScanErrorHandlerDirectives(filename string) ([]ErrorHandlerDirective, error)

ScanErrorHandlerDirectives finds all //helix:handles directives in a source file.

Jump to

Keyboard shortcuts

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