xreflect

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PatchStruct

func PatchStruct(target any, patcher any, fields ...string) (bool, error)

PatchStruct patches target with values found in patcher with both target and patcher being structs.

Only fields with same name and type can be updated.

When target is a pointer, and

The fields-argument can be used to select which fields gets patched (case-insensitive). If the fields-argument is not provided, all fields of patcher are used to update target.

If any field got update, this function returns true.

Types

type StructField

type StructField struct {
	Field reflect.StructField
	Value reflect.Value
}

func GetFields

func GetFields(v reflect.Value) []*StructField

func (*StructField) IsPointer added in v1.3.1

func (s *StructField) IsPointer() bool

Jump to

Keyboard shortcuts

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