Documentation
¶
Overview ¶
Package generator provides code generation tools for value objects.
Package generator provides code generation tools for value objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GenerateCommand ¶
type GenerateCommand struct {
// ConfigFile is the path to the configuration file.
ConfigFile string
// TemplateDir is the directory containing the templates.
TemplateDir string
// OutputDir is the directory where the generated code will be written.
OutputDir string
}
GenerateCommand is a command-line tool for generating value objects.
func NewGenerateCommand ¶
func NewGenerateCommand() *GenerateCommand
NewGenerateCommand creates a new GenerateCommand.
func (*GenerateCommand) ParseFlags ¶
func (c *GenerateCommand) ParseFlags()
ParseFlags parses the command-line flags.
type Generator ¶
type Generator struct {
// TemplateDir is the directory containing the templates.
TemplateDir string
// OutputDir is the directory where the generated code will be written.
OutputDir string
}
Generator generates code for value objects.
func NewGenerator ¶
NewGenerator creates a new Generator.
func (*Generator) Generate ¶
func (g *Generator) Generate(config ValueObjectConfig) error
Generate generates code for a value object.
type ValueObjectConfig ¶
type ValueObjectConfig struct {
// Name is the name of the value object (e.g., "Email").
Name string
// Package is the package name (e.g., "contact").
Package string
// Type is the type of value object (string or struct).
Type ValueObjectType
// Fields is a map of field names to field types (for struct-based value objects).
Fields map[string]string
// Validations is a map of field names to validation functions.
Validations map[string]string
// Imports is a list of additional imports.
Imports []string
// BaseType is the base type for string-based value objects (e.g., "string").
BaseType string
// Description is a description of the value object.
Description string
}
ValueObjectConfig contains the configuration for generating a value object.
type ValueObjectType ¶
type ValueObjectType string
ValueObjectType represents the type of value object to generate.
const ( // StringBased represents a string-based value object. StringBased ValueObjectType = "string" // StructBased represents a struct-based value object. StructBased ValueObjectType = "struct" )
Click to show internal directories.
Click to hide internal directories.