reflector

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExported = fmt.Errorf("not exported")
	ErrNoField     = fmt.Errorf("field not exists")
)

Functions

func Register

func Register(m ronykit.Message)

Register registers the message then reflector will be much faster. You should call it concurrently.

Types

type FieldInfo added in v0.6.0

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

func (FieldInfo) Kind added in v0.6.0

func (f FieldInfo) Kind() reflect.Kind

func (FieldInfo) Type added in v0.6.0

func (f FieldInfo) Type() reflect.StructField

type Object

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

func (Object) Encoding added in v0.4.5

func (o Object) Encoding() ronykit.Encoding

func (Object) GetInt

func (o Object) GetInt(fieldName string) (int, error)

func (Object) GetInt32

func (o Object) GetInt32(fieldName string) (int32, error)

func (Object) GetInt32Default

func (o Object) GetInt32Default(fieldName string, def int32) int32

func (Object) GetInt64

func (o Object) GetInt64(fieldName string) (int64, error)

func (Object) GetInt64Default

func (o Object) GetInt64Default(fieldName string, def int64) int64

func (Object) GetIntDefault

func (o Object) GetIntDefault(fieldName string, def int) int

func (Object) GetString

func (o Object) GetString(fieldName string) (string, error)

func (Object) GetStringDefault

func (o Object) GetStringDefault(fieldName string, def string) string

func (Object) GetUInt

func (o Object) GetUInt(fieldName string) (uint, error)

func (Object) GetUInt32

func (o Object) GetUInt32(fieldName string) (uint32, error)

func (Object) GetUInt32Default

func (o Object) GetUInt32Default(fieldName string, def uint32) uint32

func (Object) GetUInt64

func (o Object) GetUInt64(fieldName string) (uint64, error)

func (Object) GetUInt64Default

func (o Object) GetUInt64Default(fieldName string, def uint64) uint64

func (Object) GetUIntDefault

func (o Object) GetUIntDefault(fieldName string, def uint) uint

func (Object) Message added in v0.4.5

func (o Object) Message() ronykit.Message

func (Object) Type added in v0.6.0

func (o Object) Type() reflect.Type

func (Object) WalkFields added in v0.6.0

func (o Object) WalkFields(cb func(key string, f FieldInfo))

type Reflector

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

func New

func New() *Reflector

func (*Reflector) Get

func (r *Reflector) Get(m ronykit.Message, fieldName string) (interface{}, error)

func (*Reflector) GetInt

func (r *Reflector) GetInt(m ronykit.Message, fieldName string) (int64, error)

func (*Reflector) GetString

func (r *Reflector) GetString(m ronykit.Message, fieldName string) (string, error)

func (*Reflector) Load

func (r *Reflector) Load(m ronykit.Message) (Object, error)

Jump to

Keyboard shortcuts

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