reflectkit

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeOf

func CodeOf(v interface{}) uintptr

A faster version (25-35%) to get comparable identity of function's code. Same to reflect.ValueOf(<func>).Pointer(), but doesn't force heap-escape of the argument. NB! ONLY works for hard-coded functions. Functions created with reflect will have same code identity.

func IsNil

func IsNil(v interface{}) bool

A faster version (25-35%) to check for interface nil

func MakeAddressable

func MakeAddressable(value reflect.Value) reflect.Value

func ParseStructTag

func ParseStructTag(tag reflect.StructTag, findFn func(name, qvalue string) bool) (string, string, bool)

Types

type FieldGetterFunc

type FieldGetterFunc func(reflect.Value) reflect.Value

func FieldValueGetter

func FieldValueGetter(index int, fd reflect.StructField, useAddr bool, baseOffset uintptr) FieldGetterFunc

type IfaceToReceiverFactoryFunc

type IfaceToReceiverFactoryFunc func(t reflect.Type, checkZero bool) IfaceToReceiverFunc

type IfaceToReceiverFunc

type IfaceToReceiverFunc func(value interface{}, k reflect.Kind, out TypedReceiver)

type TypedReceiver

type TypedReceiver interface {
	ReceiveBool(reflect.Kind, bool)
	ReceiveInt(reflect.Kind, int64)
	ReceiveUint(reflect.Kind, uint64)
	ReceiveFloat(reflect.Kind, float64)
	ReceiveComplex(reflect.Kind, complex128)
	ReceiveString(reflect.Kind, string)
	ReceiveZero(reflect.Kind)
	ReceiveNil(reflect.Kind)
	ReceiveIface(reflect.Kind, interface{})
	ReceiveElse(t reflect.Kind, v interface{}, isZero bool)
}

type ValueToReceiverFactoryFunc

type ValueToReceiverFactoryFunc func(unexported bool, t reflect.Type, checkZero bool) (bool, ValueToReceiverFunc)

type ValueToReceiverFunc

type ValueToReceiverFunc func(value reflect.Value, out TypedReceiver)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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