pointer

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldName

func FieldName[B any, F any](r *Registry, base *B, fieldPtr *F) string

FieldName returns the Go field name for a field pointer.

func HasTag

func HasTag[B any, F any](r *Registry, base *B, fieldPtr *F, key string) bool

HasTag returns true if the tag key exists for a field pointer.

func TagValue

func TagValue[B any, F any](r *Registry, base *B, fieldPtr *F, key string) string

TagValue returns the first value of a tag key for a field pointer.

Types

type FieldInfo

type FieldInfo struct {
	Name   string              // Go struct field name
	Offset uintptr             // Memory offset from struct base
	Type   reflect.Type        // Field type
	Tags   map[string][]string // Parsed tags for the configured tagName
}

FieldInfo holds identity and tag metadata for a struct field.

type Registry

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

Registry manages the mapping of struct types to their field offsets.

func NewRegistry

func NewRegistry(tagName string) *Registry

NewRegistry creates a new Registry that parses the given tagName.

func (*Registry) Register

func (r *Registry) Register(v any)

Register inspects a struct type and builds the field mapping.

func (*Registry) Resolve

func (r *Registry) Resolve(base any, fieldPtr any) (*FieldInfo, error)

Resolve retrieves field info for a given base struct and field pointer.

Jump to

Keyboard shortcuts

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