typewalk

package
v1.94.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package typewalk provides utilities to walk Go types using reflection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchingPaths

func MatchingPaths(rt reflect.Type, match func(reflect.Type) bool) iter.Seq[Path]

MatchingPaths returns a sequence of Path for all paths within the given type that end in a type matching match.

Types

type Path

type Path struct {
	// Name is the path from the root type, suitable for using as a t.Run name.
	Name string

	// Walk returns the reflect.Value at the end of the path, given a root
	// reflect.Value.
	Walk func(root reflect.Value) (leaf reflect.Value)
}

Path describes a path via a type where a private key may be found, along with a function to test whether a reflect.Value at that path is non-zero.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL