reflext

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilViewContext = errors.New("nil view context")
	ErrNilExprNode    = errors.New("nil expr node")
	ErrNotValid       = errors.New("value not valid")
)

Functions

func CreatePrimitiveValue

func CreatePrimitiveValue(rtype reflect.Type, s string) (reflect.Value, error)

解析字符串的值到value

func EnumerateCallable

func EnumerateCallable(v interface{}) map[string]reflect.Value

枚举可调用函数

func EvalRemove

func EvalRemove(this interface{}, expr string) error

在`this`上, 删除对应`expr`的节点,只有map和slice可以有删除操作

func EvalSet

func EvalSet(this interface{}, expr string, v interface{}) error

在`this`上,设置v到对应`expr`

func EvalView

func EvalView(this interface{}, expr string) (result interface{}, err error)

在`this`上,返回其`expr`对应的值

func FormatToString

func FormatToString(v interface{}) string

func InvokeCallable

func InvokeCallable(callable reflect.Value, args []string) (outResult, outErr interface{}, err error)

func IsFloat

func IsFloat(kind reflect.Kind) bool

浮点数

func IsInteger

func IsInteger(kind reflect.Kind) bool

整数

func IsInterfaceNil

func IsInterfaceNil(c interface{}) bool

interface是否是nil

func IsNumber

func IsNumber(kind reflect.Kind) bool

func IsPrimitive

func IsPrimitive(kind reflect.Kind) bool

基本类型

func IsUnsigned

func IsUnsigned(kind reflect.Kind) bool

func ParseCallExpr added in v1.2.1

func ParseCallExpr(expr string) (fnName string, params []string, outErr error)

把一个函数调用解析为函数名和参数

Types

This section is empty.

Jump to

Keyboard shortcuts

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