reflect

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package reflect provides reflection utilities for struct manipulation.

Index

Constants

View Source
const Ptr = reflect.Ptr

Ptr is reflect.Ptr.

Variables

View Source
var (
	Append      = reflect.Append
	AppendSlice = reflect.AppendSlice
	ChanOf      = reflect.ChanOf
	CopySlice   = reflect.Copy
	DeepEqual   = reflect.DeepEqual
	Indirect    = reflect.Indirect
	MakeChan    = reflect.MakeChan
	MakeFunc    = reflect.MakeFunc
	MakeMap     = reflect.MakeMap
	MakeSlice   = reflect.MakeSlice
	MapOf       = reflect.MapOf
	New         = reflect.New
	NewAt       = reflect.NewAt
	PtrTo       = reflect.PtrTo
	Select      = reflect.Select
	SliceOf     = reflect.SliceOf
	TypeOf      = reflect.TypeOf
	ValueOf     = reflect.ValueOf
	Zero        = reflect.Zero
)

Standard reflect function aliases.

Functions

func Copy

func Copy(src interface{}, dst interface{}) (err error)

Copy copies fields from src to dst using reflection. Supports struct-to-struct and slice-to-slice copying.

func FieldNames

func FieldNames(s interface{}) []string

FieldNames returns all field names of a struct.

func IsPtrSlice

func IsPtrSlice(v reflect.Value) bool

IsPtrSlice returns true if v is a pointer to a slice.

func IsSliceOfPtr

func IsSliceOfPtr(slice reflect.Value) bool

IsSliceOfPtr returns true if the slice contains pointers.

func IsZero

func IsZero(v reflect.Value) bool

IsZero returns true if the value is the zero value for its type.

func SetField

func SetField(ps reflect.Value, name string, value interface{}) error

SetField sets a field on an addressable struct by name.

Types

type Type

type Type = reflect.Type

Type aliases reflect.Type.

Jump to

Keyboard shortcuts

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