Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Visitor ¶
type Visitor struct {
// contains filtered or unexported fields
}
func NewVisitor ¶
func (*Visitor) Visit ¶
func (v *Visitor) Visit(rootInstance *reflect.Value, f func(t Walker[reflect.Type]) []Walker[reflect.Type])
Visit traverses the structure of the provided rootInstance using reflection, starting from the type stored in the Visitor. It applies the user-provided function f to each struct type encountered, allowing custom logic to generate additional types to visit. The traversal handles optional types (structs with names prefixed by "Opt") by mapping their "Value" field to the underlying type and supports indirect pointer dereferencing. The function f receives a Walker containing the current type, a string prefix, and an OptSetter representing the value being visited. The traversal continues as long as f returns additional Walker instances to process.