Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidType = errors.New("invalid-type") ErrInvalidValue = errors.New("invalid-value") )
Functions ¶
This section is empty.
Types ¶
type TargetVisitorFunc ¶
type TypeVisitorTree ¶
type TypeVisitorTree struct {
// contains filtered or unexported fields
}
func New ¶
func New(rootType, targetType any, tagName string) (*TypeVisitorTree, error)
New constructs a tree that is tailored to visit all instances of the target type that are found below the root type the root type must be a pointer to a struct, the target type can be any type and tagName specifies a tag that will be searched for the tag string content on a struct field will be passed to the callback, if the field is a map of slice of array of pointer of map of target type, then the tag will still be passed along this will not work on non-exported or anonymous struct fields and pointer loops are not detected
func (TypeVisitorTree) Visit ¶
func (tvt TypeVisitorTree) Visit(value any, targetVisitor TargetVisitorFunc) error
Visit must be called with the root type the tree was constructed for and will call the user callback on all target type instances