ptrmap

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package ptrmap provides a function to collect pointers to struct fields from a given struct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector is a struct that collects pointers to fields of a struct, excluding fields based on the provided predicates.

func DefaultCollector

func DefaultCollector() *Collector

DefaultCollector returns a Collector with default exclusion rules.

func New

func New(predicates ...ExcludePredicate) *Collector

New returns a new Collector with the given exclude predicates.

func (*Collector) AddExcludePredicate

func (c *Collector) AddExcludePredicate(pred ExcludePredicate)

AddExcludePredicate adds an exclusion predicate to the Collector.

func (*Collector) Collect

func (c *Collector) Collect(v any) map[string]any

Collect recursively collects pointers to fields of a struct.

type ExcludePredicate

type ExcludePredicate func(field reflect.StructField, value reflect.Value) bool

ExcludePredicate is a function type that defines a predicate for excluding fields from collection.

Jump to

Keyboard shortcuts

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