gen

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Generator package

The generator takes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRulesJson added in v0.8.0

func CheckRulesJson(file string, bytes []byte) error

func CompareContentWithFile

func CompareContentWithFile(sourceBytes []byte, target string) (bool, error)

func New

func New(opts Options) (*generator, error)

func NewOutputWriter added in v0.35.0

func NewOutputWriter() *fsWriter

func ReadRulesDoc added in v0.8.0

func ReadRulesDoc(filename string) (*spec.RulesDoc, error)

ReadRulesDoc reads rules from a file.

func RenderString added in v0.38.1

func RenderString(s string, ctx any) (string, error)

Renders a string using the given context

Types

type GeneratorStats added in v0.8.0

type GeneratorStats struct {
	FilesWritten int           `json:"files_written"`
	FilesSkipped int           `json:"files_skipped"`
	FilesCopied  int           `json:"files_copied"`
	FilesTouched []string      `json:"files_touched"`
	RunStart     time.Time     `json:"run_start"`
	RunEnd       time.Time     `json:"run_end"`
	Duration     time.Duration `json:"duration"`
}

func (*GeneratorStats) Start added in v0.8.0

func (g *GeneratorStats) Start()

func (*GeneratorStats) Stop added in v0.8.0

func (g *GeneratorStats) Stop()

func (*GeneratorStats) TotalFiles added in v0.8.0

func (s *GeneratorStats) TotalFiles() int

type MockOutput added in v0.20.0

type MockOutput struct {
	Writes   map[string]string
	Copies   map[string]string
	Compares map[string]bool
}

func NewMockOutput added in v0.20.0

func NewMockOutput() *MockOutput

func (*MockOutput) Compare added in v0.20.0

func (m *MockOutput) Compare(input []byte, target string) (bool, error)

func (*MockOutput) Copy added in v0.20.0

func (m *MockOutput) Copy(source, target string) error

func (*MockOutput) Write added in v0.20.0

func (m *MockOutput) Write(input []byte, target string) error

type Options added in v0.35.0

type Options struct {
	// OutputDir is the directory where files are written
	OutputDir string
	// TemplatesDir is the directory where templates are located
	TemplatesDir string
	// System is the root system model
	System *model.System
	// Features is a list of features defined by user
	Features []string
	// Force forces overwrite of existing files
	Force bool
	// Output is the output writer
	Output OutputWriter
	// DryRun does not write files
	DryRun bool
	// Meta is a map of metadata
	Meta map[string]any
}

type OutputWriter added in v0.29.1

type OutputWriter interface {
	Write(input []byte, target string) error
	Copy(source, target string) error
	Compare(input []byte, target string) (bool, error)
}

Jump to

Keyboard shortcuts

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