reflectutil

package
v0.34.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(value reflect.Value, field rivertags.Field) reflect.Value

Get returns the nested field of value corresponding to index. Get panics if not given a struct.

It is similar to reflect/Value.FieldByIndex but can handle traversing through nil pointers. If Get traverses through a nil pointer, a non-settable zero value for the final field is returned.

func GetOrAlloc

func GetOrAlloc(value reflect.Value, field rivertags.Field) reflect.Value

GetOrAlloc returns the nested field of value corresponding to index. GetOrAlloc panics if not given a struct.

func GetOrAllocIndex

func GetOrAllocIndex(value reflect.Value, index []int) reflect.Value

GetOrAllocIndex returns the nested field of value corresponding to index. GetOrAllocIndex panics if not given a struct.

It is similar to reflect/Value.FieldByIndex but can handle traversing through nil pointers. If allocate is true, GetOrAllocIndex allocates any intermediate nil pointers while traversing the struct.

Types

This section is empty.

Jump to

Keyboard shortcuts

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