Documentation
¶
Index ¶
- func DetectModule() (string, error)
- func EnabledFeatures(features map[string]bool) []string
- func FeaturesListString(features map[string]bool) string
- func IsValidIdentifier(s string) bool
- func IsValidSnakeCase(s string) bool
- func ParseFeatures(featureStr, templateType string) map[string]bool
- func ResolveFeatureDependencies(features map[string]bool) map[string]bool
- func ResolveModule(moduleName string) (string, error)
- type GeneratorConfig
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectModule ¶
DetectModule reads go.mod from the current directory and returns the module path.
func EnabledFeatures ¶
EnabledFeatures returns a sorted list of enabled feature names.
func FeaturesListString ¶
FeaturesListString returns a comma-separated string of enabled features.
func IsValidIdentifier ¶
IsValidIdentifier checks whether s is a valid Go-style identifier (lowercase alpha + digits).
func IsValidSnakeCase ¶
IsValidSnakeCase checks whether s is a valid snake_case identifier.
func ParseFeatures ¶
ParseFeatures parses a comma-separated feature string and applies template defaults.
func ResolveFeatureDependencies ¶
ResolveFeatureDependencies ensures all required feature dependencies are satisfied.
func ResolveModule ¶
ResolveModule returns moduleName if non-empty, otherwise auto-detects from go.mod.
Types ¶
type GeneratorConfig ¶
type GeneratorConfig struct {
// Directory conventions (relative to project root)
MicroserviceDir string `yaml:"microservice_dir"` // e.g. "internal/ms"
DomainDir string `yaml:"domain_dir"` // e.g. "internal/domain"
ModelsDir string `yaml:"models_dir"` // e.g. "pkg/models"
ConfigsDir string `yaml:"configs_dir"` // e.g. "misc/configs"
CmdDir string `yaml:"cmd_dir"` // e.g. "cmd/ms"
// Naming conventions
MicroservicePrefix string `yaml:"microservice_prefix"` // e.g. "ms_"
BusinessLayerSuffix string `yaml:"business_layer_suffix"` // e.g. "_business_layer"
// OpenAPI defaults
OpenAPITitle string `yaml:"openapi_title"` // default title for OpenAPI spec
OpenAPIServers []string `yaml:"openapi_servers"` // default server URLs
OAuthAuthorize string `yaml:"oauth_authorize"` // OAuth authorize URL
OAuthToken string `yaml:"oauth_token"` // OAuth token URL
// Module name (auto-detected from go.mod if empty)
ModuleName string `yaml:"module_name"`
}
GeneratorConfig holds all configurable paths and conventions for code generation. Paths are relative to the project root. Loaded from .pixie.yaml or pixie.yaml if present, otherwise sensible defaults are used.
func DefaultConfig ¶
func DefaultConfig() GeneratorConfig
DefaultConfig returns a GeneratorConfig with sensible defaults.
func LoadConfig ¶
func LoadConfig() (GeneratorConfig, error)
LoadConfig loads configuration from .pixie.yaml or pixie.yaml in the current directory. If no config file is found, returns DefaultConfig with no error.
type TemplateData ¶
type TemplateData struct {
// Basic information
ServiceName string // user_management (for microservices) or custom service name
ServiceNameCamel string // UserManagement (for microservices) or custom service name
DomainName string // users
DomainNameCamel string // Users
ModuleName string // github.com/company/my-project
RepositoryName string // For repositories: custom name or domain name
RepositoryNameCamel string // CamelCase version of RepositoryName
EntityName string // For entities: custom name or domain name
EntityNameCamel string // CamelCase version of EntityName
// Features
Features map[string]bool // Feature flags
// Configuration
Port int // HTTP server port
MetricsPort int // Metrics server port
Timestamp string // Generation timestamp
MigrationTimestamp string // Migration timestamp for DB migrations
// Database configuration (with defaults)
DatabaseHost string
DatabasePort int
DatabaseName string
DatabaseUsername string
DatabasePassword string
DatabaseSSLMode string
DatabaseMaxOpenConnections int
DatabaseMaxIdleConnections int
DatabaseConnectionMaxLifetime string
// Redis configuration (with defaults)
RedisHost string
RedisPort int
RedisPassword string
RedisDatabase int
// Security configuration (with defaults)
JWTSecretKey string
AdminAPIKey string
}
TemplateData holds the data passed to scaffold templates.
func NewTemplateData ¶
func NewTemplateData() TemplateData
NewTemplateData creates a TemplateData with timestamp defaults populated.