Documentation
¶
Overview ¶
Package rules provides an extensible rules engine for normalizing VCTM data. Rules can transform, fix, or validate VCTM documents to ensure compatibility with the latest specification or to handle legacy field names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine manages and applies normalization rules
func NewEmptyEngine ¶
func NewEmptyEngine() *Engine
NewEmptyEngine creates a rules engine without any rules
func NewEngine ¶
func NewEngine() *Engine
NewEngine creates a new rules engine with the default built-in rules
func (*Engine) SetVerbose ¶
SetVerbose enables verbose logging of rule applications
type Result ¶
type Result struct {
Applied []string // Names of rules that made changes
Skipped []string // Names of disabled rules
}
Result contains the outcome of applying rules
func (*Result) HasChanges ¶
HasChanges returns true if any rules made changes
type Rule ¶
type Rule interface {
// Name returns the unique identifier for this rule
Name() string
// Description returns a human-readable description of what the rule does
Description() string
// Apply transforms the VCTM data in place and returns true if any changes were made.
// The rule receives the entire VCTM document as a map for maximum flexibility.
Apply(data map[string]interface{}) (changed bool, err error)
}
Rule defines the interface for a normalization rule. Rules are applied to VCTM data represented as map[string]interface{} to allow flexible transformation regardless of the source (markdown, JSON, etc.).
type RuleFunc ¶
type RuleFunc struct {
// contains filtered or unexported fields
}
RuleFunc is a convenience type for creating rules from functions