reflect

package
v1.2.117 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldByNames

func FieldByNames[V any, X any](v V, names ...string) (x X, ok bool)

FieldByNames returns the struct field with the given names. It returns the zero Value if no field was found. It panics if v's Kind is not struct or x's Kind is not X.

func SetFieldByNames

func SetFieldByNames[V any, X any](v any, names []string, x X) (ok bool)

SetFieldByNames assigns x to the value v. It panics if CanSet returns false. As in Go, x's value must be assignable to type of v's son, grandson, etc

Types

This section is empty.

Jump to

Keyboard shortcuts

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