refl

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

README

Refl

Refl is a simple, useful utility package for "reflect" in Go.

CI Licensed Twitter

| Examples | Latest Note |

go get -u github.com/just-do-halee/refl

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(value any, o *Option) (t Type, v Value)

func GetTypeName

func GetTypeName(t Type) (origin string, generic string)

func GetTypeNameAny

func GetTypeNameAny(i any) (name string, generic string)

func IsBothType

func IsBothType(a, b any) bool

func IsBothValue

func IsBothValue(a, b any) bool

func NameEq

func NameEq(a, b Type) bool

func NameEqAny

func NameEqAny(a, b any) bool

func NameEqAnyWithGeneric

func NameEqAnyWithGeneric(a, b any) bool

func NameEqWithGeneric

func NameEqWithGeneric(a, b Type) bool

func TypeEq

func TypeEq(a, b any) bool

func ValueEq

func ValueEq(a, b any) bool

Types

type Kind

type Kind = reflect.Kind

type Option

type Option struct {
	Unwrap bool
}

type Struct

type Struct struct {
	Type  Type
	Value Value
	Size  int
}

func GetStruct

func GetStruct(i any) Struct

func (Struct) Field added in v0.2.0

func (s Struct) Field(index int) StructField

type StructField

type StructField struct {
	reflect.StructField
	Parent Struct
	Index  int
	Type   Type
	Value  Value
	Tag    Tag
}

type Tag

type Tag = reflect.StructTag

type Type

type Type = reflect.Type

func TypeOf added in v0.3.0

func TypeOf(i any) Type

func UnwrapType

func UnwrapType(t Type) (u Type)

type Value

type Value = reflect.Value

func UnwrapValue

func UnwrapValue(v Value) (u Value)

func ValueOf added in v0.3.0

func ValueOf(i any) Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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