reflect

package
v0.0.68 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFieldTags added in v0.0.34

func AllFieldTags(req interface{}, key string) []string

func AllTagsValues added in v0.0.34

func AllTagsValues(req interface{}, key string) map[string]interface{}

only get export Fields

func IsZeroValue added in v0.0.33

func IsZeroValue(v reflect.Value) bool

cmd/compile/internal/gc/dump.go

func NonzeroFieldTags added in v0.0.33

func NonzeroFieldTags(req interface{}, key string) []string

req must be struct(Not pointer to struct), or return nil(tt.Field() will panic) key for tag , db or json, if key is empty, use field name instead

func ReflectValue added in v0.0.60

func ReflectValue(valueType string, value interface{}) (reflect.Value, error)

ReflectValue converts interface{} to reflect.Value based on string type

func RetrieveStructField

func RetrieveStructField(req interface{}, name string) string

func TruncateBytes added in v0.0.57

func TruncateBytes(req interface{}) interface{}

https://stackoverflow.com/questions/6395076/using-reflect-how-do-you-set-the-value-of-a-struct-field truncate []byte, [][]byte, not support others, eg: [][][]byte struct must use pointer of sturct, or not rewrite it

func TrySetStructFiled

func TrySetStructFiled(req interface{}, name, value string)

Types

type ErrUnsupportedType added in v0.0.60

type ErrUnsupportedType struct {
	// contains filtered or unexported fields
}

ErrUnsupportedType ...

func NewErrUnsupportedType added in v0.0.60

func NewErrUnsupportedType(valueType string) ErrUnsupportedType

NewErrUnsupportedType returns new ErrUnsupportedType

func (ErrUnsupportedType) Error added in v0.0.60

func (e ErrUnsupportedType) Error() string

Error method so we implement the error interface

Jump to

Keyboard shortcuts

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