reflext

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: BSD-3-Clause Imports: 11 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 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

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

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

Types

type EvalContext added in v0.1.9

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

func NewEvalContext added in v0.1.9

func NewEvalContext(this interface{}) *EvalContext

func (*EvalContext) Delete added in v0.1.9

func (c *EvalContext) Delete(expr string) error

delete a[X]

func (*EvalContext) Set added in v0.1.9

func (c *EvalContext) Set(expr string, v interface{}) error

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

func (*EvalContext) View added in v0.1.9

func (c *EvalContext) View(expr string) (interface{}, error)

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

Jump to

Keyboard shortcuts

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