reflector

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: BSD-3-Clause Imports: 7 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, tags ...string)

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 Fields added in v0.6.2

type Fields map[string]FieldInfo

func (Fields) Get added in v0.6.2

func (fields Fields) Get(m ronykit.Message, fieldName string) interface{}

func (Fields) GetInt added in v0.6.2

func (fields Fields) GetInt(m ronykit.Message, fieldName string) (int, error)

func (Fields) GetInt32 added in v0.6.2

func (fields Fields) GetInt32(m ronykit.Message, fieldName string) (int32, error)

func (Fields) GetInt32Default added in v0.6.2

func (fields Fields) GetInt32Default(m ronykit.Message, fieldName string, def int32) int32

func (Fields) GetInt64 added in v0.6.2

func (fields Fields) GetInt64(m ronykit.Message, fieldName string) (int64, error)

func (Fields) GetInt64Default added in v0.6.2

func (fields Fields) GetInt64Default(m ronykit.Message, fieldName string, def int64) int64

func (Fields) GetIntDefault added in v0.6.2

func (fields Fields) GetIntDefault(m ronykit.Message, fieldName string, def int) int

func (Fields) GetString added in v0.6.2

func (fields Fields) GetString(m ronykit.Message, fieldName string) (string, error)

func (Fields) GetStringDefault added in v0.6.2

func (fields Fields) GetStringDefault(m ronykit.Message, fieldName string, def string) string

func (Fields) GetUInt added in v0.6.2

func (fields Fields) GetUInt(m ronykit.Message, fieldName string) (uint, error)

func (Fields) GetUInt32 added in v0.6.2

func (fields Fields) GetUInt32(m ronykit.Message, fieldName string) (uint32, error)

func (Fields) GetUInt32Default added in v0.6.2

func (fields Fields) GetUInt32Default(m ronykit.Message, fieldName string, def uint32) uint32

func (Fields) GetUInt64 added in v0.6.2

func (fields Fields) GetUInt64(m ronykit.Message, fieldName string) (uint64, error)

func (Fields) GetUInt64Default added in v0.6.2

func (fields Fields) GetUInt64Default(m ronykit.Message, fieldName string, def uint64) uint64

func (Fields) GetUIntDefault added in v0.6.2

func (fields Fields) GetUIntDefault(m ronykit.Message, fieldName string, def uint) uint

func (Fields) WalkFields added in v0.6.2

func (fields Fields) WalkFields(cb func(key string, f FieldInfo))

type Reflected added in v0.6.2

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

func (Reflected) ByTag added in v0.6.2

func (r Reflected) ByTag(t string) (Fields, bool)

func (Reflected) Obj added in v0.6.2

func (r Reflected) Obj() Fields

func (Reflected) Type added in v0.6.2

func (r Reflected) Type() reflect.Type

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, tags ...string) *Reflected

Jump to

Keyboard shortcuts

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