Documentation
¶
Overview ¶
Package typeinfo provides a single, cached reflect.Type walker for FastConf's per-T metadata extraction (secret paths, default tags, top-level field hashers). It is the canonical home of FieldName(), the json/yaml/lower(field) tag resolution previously duplicated in core_secret.go and core_watch.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldName ¶
func FieldName(f reflect.StructField) string
FieldName returns the canonical FastConf name for a struct field: json tag → yaml tag → lower(name). Anonymous fields with no tag return the empty string so callers can flatten the path.
Types ¶
type Cache ¶
type Cache[V any] struct { // contains filtered or unexported fields }
Cache offers a per-Type, per-Visitor-key result cache so callers (secretPathsFor, planForType, buildFieldHashers) can each maintain their own answer set without re-walking the type on every reload.
func (*Cache[V]) GetOrCompute ¶
GetOrCompute returns the cached value for t or computes it via fn. fn runs while the cache lock is held, so it must be deterministic and must not call GetOrCompute on the same Cache.
type Visitor ¶
type Visitor interface {
// OnField fires once per exported struct field (including those reached
// through anonymous embeds), with the dotted JSON path, field index
// path, and the StructField itself. Return false to skip descending
// into this field's sub-tree.
OnField(path string, index []int, f reflect.StructField) bool
// OnStructEnter fires before descending into a struct type.
// Return false to skip the entire struct.
OnStructEnter(path string, t reflect.Type) bool
// OnStructLeave fires after all fields of a struct have been visited.
OnStructLeave(path string, t reflect.Type)
}
Visitor receives per-field callbacks during Walk.