reflect_

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PtrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const, sizeof *void

Variables

This section is empty.

Functions

func DumpTypeInfoBFS

func DumpTypeInfoBFS(t reflect.Type) string

func DumpTypeInfoDFS

func DumpTypeInfoDFS(t reflect.Type) string

func DumpValueInfoBFS

func DumpValueInfoBFS(v reflect.Value) string

func DumpValueInfoDFS

func DumpValueInfoDFS(v reflect.Value) string

func FollowTypePointer

func FollowTypePointer(v reflect.Type) reflect.Type

func FollowValuePointer

func FollowValuePointer(v reflect.Value) reflect.Value

func IsEmptyValue

func IsEmptyValue(v reflect.Value) bool

func IsFieldExported

func IsFieldExported(sf reflect.StructField) bool

func IsNilObject

func IsNilObject(obtained interface{}) (result bool)

func IsNilType

func IsNilType(v reflect.Type) (result bool)

nil, unknown type

func IsNilValue

func IsNilValue(v reflect.Value) (result bool)

func IsValidTagName

func IsValidTagName(tagName string) bool

func IsZeroValue

func IsZeroValue(v reflect.Value) bool

func TypeByStructFieldIndex

func TypeByStructFieldIndex(t reflect.Type, index []int) reflect.Type

t[i][j][...], t[i] is t's ith field, t[i][j] is t[i]'s jth field

func ValueByStructFieldIndex

func ValueByStructFieldIndex(v reflect.Value, index []int) reflect.Value

v[i][j][...], v[i] is v's ith field, v[i][j] is v[i]'s jth field

func Walk

func Walk(t reflect.Type, visitedOnce bool, do func(s reflect.Type, sf reflect.StructField) (stop bool))

walks down v

func WalkTypeBFS

func WalkTypeBFS(typ reflect.Type, parseFn func(info FieldTypeInfo) (goon bool))

Breadth First Search

func WalkTypeDFS

func WalkTypeDFS(typ reflect.Type, parseFn func(info FieldTypeInfo) (goon bool))

Wid First Search

func WalkValueBFS

func WalkValueBFS(val reflect.Value, parseFn func(info FieldValueInfo) (goon bool))

Breadth First Search

func WalkValueDFS

func WalkValueDFS(val reflect.Value, parseFn func(info FieldValueInfo) (goon bool))

Types

type FieldTypeInfo

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

A field represents a single field found in a struct.

func (FieldTypeInfo) Depth

func (thiz FieldTypeInfo) Depth() int

func (FieldTypeInfo) Index

func (thiz FieldTypeInfo) Index() []int

func (FieldTypeInfo) Middles

func (thiz FieldTypeInfo) Middles() []interface{}

func (FieldTypeInfo) String

func (thiz FieldTypeInfo) String() string

func (FieldTypeInfo) StructField

func (thiz FieldTypeInfo) StructField() (reflect.StructField, bool)

type FieldValueInfo

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

A field represents a single field found in a struct.

func (FieldValueInfo) Depth

func (thiz FieldValueInfo) Depth() int

func (FieldValueInfo) Index

func (thiz FieldValueInfo) Index() []int

func (FieldValueInfo) Middles

func (thiz FieldValueInfo) Middles() []interface{}

func (*FieldValueInfo) String

func (thiz *FieldValueInfo) String() string

func (FieldValueInfo) StructField

func (thiz FieldValueInfo) StructField() (reflect.StructField, bool)

func (FieldValueInfo) Value

func (thiz FieldValueInfo) Value() reflect.Value

type TagOptions

type TagOptions string

TagOptions is the string following a comma in a struct field's "json" tag, or the empty string. It does not include the leading comma.

func ParseTagOptions

func ParseTagOptions(tag string) (tagName string, opts TagOptions)

ParseTagOptions splits a struct field's json tag into its name and comma-separated options.

func (TagOptions) Contains

func (o TagOptions) Contains(optionName string) bool

Contains reports whether a comma-separated list of options contains a particular substr flag. substr must be surrounded by a string boundary or commas.

Jump to

Keyboard shortcuts

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