types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsInterface

func AsInterface[T any](v reflect.Value) (T, error)

func CopyAndIndirect

func CopyAndIndirect(n int, s any) any

func CountIndirectionsBetweenTypes

func CountIndirectionsBetweenTypes(t1 reflect.Type, t2 reflect.Type) (int, error)

CountIndirectionsBetweenTypes returns the number of indirections between t1 and t2, where t1 points through some level of indirection to t2

func CountIndirectionsBetweenTypesUnsafely

func CountIndirectionsBetweenTypesUnsafely(t1 reflect.Type, t2 reflect.Type) int

func EnsureConcreteValue

func EnsureConcreteValue(v reflect.Value) (reflect.Value, error)

func FollowPointersToConcreteType

func FollowPointersToConcreteType(t reflect.Type) (reflect.Type, int)

func FollowPointersToConcreteValue

func FollowPointersToConcreteValue(v reflect.Value) any

func GetNilValue

func GetNilValue(t reflect.Type) (any, error)

GetNilValue returns a nil value for the given type, if the type can be set to nil. Otherwise, it returns an error

func GetTypeName

func GetTypeName(t reflect.Type) string

func Indirect

func Indirect(n int, s any) (any, error)

func TypeImplementsInterface

func TypeImplementsInterface[T any](t reflect.Type) bool

Types

type Field

type Field struct {
	Name  string
	Value any
}

func GetFields

func GetFields[T any](v T) []Field

Jump to

Keyboard shortcuts

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