generator

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationPoints added in v1.4.0

type AggregationPoints struct {
	GeneratedServices string
	GeneratedRoutes   string
	GeneratedRuntime  string
	GeneratedChain    string
}

type ArtifactPlan added in v1.4.0

type ArtifactPlan struct {
	NewFiles       []PlannedFile
	UpdatedFiles   []PlannedUpdate
	ProtectedSkips []string
	Warnings       []string
}

func BuildAppendMiddlewarePlan added in v1.4.0

func BuildAppendMiddlewarePlan(existing *ExistingProject, project *ir.Project, opts Options, extend ExtendOptions) (*ArtifactPlan, error)

BuildAppendMiddlewarePlan validates an append-middleware request and reports which generated chain files would be refreshed.

func BuildAppendModelPlan added in v1.4.0

func BuildAppendModelPlan(existing *ExistingProject, project *ir.Project, opts Options, extend ExtendOptions) (*ArtifactPlan, error)

BuildAppendModelPlan validates an append-model request and reports the exact generated files that can be safely added or refreshed.

func BuildAppendServicePlan added in v1.4.0

func BuildAppendServicePlan(existing *ExistingProject, project *ir.Project, opts Options, extend ExtendOptions) (*ArtifactPlan, error)

BuildAppendServicePlan validates an append-service request and reports the exact files that a future extend apply phase would need to create or update.

type ExistingModel added in v1.4.0

type ExistingModel struct {
	Name string
	File string
}

type ExistingProject added in v1.4.0

type ExistingProject struct {
	Root              string
	ModulePath        string
	IDLPath           string
	Services          []ExistingService
	Models            []ExistingModel
	AggregationPoints AggregationPoints
	Ownership         map[string]FileOwnership
	Warnings          []string
	Features          ExistingProjectFeatures
}

func ScanExistingProject added in v1.4.0

func ScanExistingProject(root string) (*ExistingProject, error)

ScanExistingProject inspects an existing target tree and classifies files according to the microgen ownership model used by future extend flows.

type ExistingProjectFeatures added in v1.4.0

type ExistingProjectFeatures struct {
	WithConfig           bool
	WithTests            bool
	WithModel            bool
	WithGRPC             bool
	WithDB               bool
	WithSwag             bool
	WithSkill            bool
	RoutePrefix          string
	GeneratedMiddlewares []string
}

type ExistingService added in v1.4.0

type ExistingService struct {
	Name              string
	PackageName       string
	ServiceFile       string
	EndpointFile      string
	HTTPTransportFile string
	GRPCTransportFile string
}

type ExtendOptions added in v1.4.0

type ExtendOptions struct {
	AppendService    string
	AppendModel      string
	AppendMiddleware []string
}

type ExtendResult added in v1.4.0

type ExtendResult struct {
	Plan *ArtifactPlan
}

func ApplyAppendMiddleware added in v1.4.0

func ApplyAppendMiddleware(templateFS fs.FS, root string, source *ir.Project, opts ExtendOptions, idlSourcePath string) (*ExtendResult, error)

ApplyAppendMiddleware refreshes generator-owned endpoint middleware seams for supported generated middleware names while preserving user custom chains.

func ApplyAppendModel added in v1.4.0

func ApplyAppendModel(templateFS fs.FS, root string, source *ir.Project, opts ExtendOptions, idlSourcePath string) (*ExtendResult, error)

ApplyAppendModel performs a safe append-model update against an existing generated project. The source contract must contain the full combined service/model contract so generator-owned wiring can be refreshed safely.

func ApplyAppendService added in v1.4.0

func ApplyAppendService(templateFS fs.FS, root string, source *ir.Project, opts ExtendOptions, idlSourcePath string) (*ExtendResult, error)

ApplyAppendService performs a safe append-service update against an existing generated project. The provided source project must contain the existing services plus the new service to append so generator-owned aggregation files can be regenerated deterministically.

type FileOwnership added in v1.4.0

type FileOwnership struct {
	Path   string
	Tier   OwnershipTier
	Reason string
}

type Generator

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

Generator executes project generation from parsed definitions.

func New

func New(opt Options) (*Generator, error)

New creates a new generator.

func (*Generator) GenerateIR added in v1.3.0

func (g *Generator) GenerateIR(project *ir.Project) error

GenerateIR runs generation directly from the shared IR.

type Options

type Options struct {
	TemplateFS           fs.FS
	OutputDir            string
	ImportPath           string
	ServiceName          string
	Protocols            []string
	WithConfig           bool
	WithDocs             bool
	WithTests            bool
	WithModel            bool
	WithGRPC             bool
	WithDB               bool
	DBDriver             string
	WithSwag             bool
	WithSkill            bool
	IDLSrcPath           string
	RoutePrefix          string
	GeneratedMiddlewares []string
}

Options configures generation behavior.

type OwnershipTier added in v1.4.0

type OwnershipTier string
const (
	OwnershipGeneratorRebuildable OwnershipTier = "generator_rebuildable"
	OwnershipGeneratorAggregation OwnershipTier = "generator_aggregation"
	OwnershipUserProtected        OwnershipTier = "user_protected"
)

type PlannedFile added in v1.4.0

type PlannedFile struct {
	Path      string
	Ownership OwnershipTier
	Reason    string
}

type PlannedUpdate added in v1.4.0

type PlannedUpdate struct {
	Path      string
	Ownership OwnershipTier
	Reason    string
}

type SvcRoute added in v1.2.0

type SvcRoute struct {
	Service    *ir.Service
	FullPrefix string
}

SvcRoute is a helper for main.tmpl.

Jump to

Keyboard shortcuts

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