core

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS_KEY string = "Success"
	FAILED_KEY  string = "Failed"
	ACTIONS_KEY string = "Actions"
)

Variables

View Source
var GlobalConfig typex.RulexConfig
View Source
var GlobalStore typex.XStore
View Source
var INIPath string

Functions

func ExecuteActions

func ExecuteActions(rule *typex.Rule, arg lua.LValue) (lua.LValue, error)

* * Execute Lua Callback *

func ExecuteExpression

func ExecuteExpression(rule *typex.Rule, env map[string]interface{}) (interface{}, error)

* * Execute Expression * https://expr.medv.io/docs/Getting-Started *

func ExecuteFailed

func ExecuteFailed(vm *lua.LState, arg lua.LValue) (interface{}, error)

func ExecuteSuccess

func ExecuteSuccess(vm *lua.LState) (interface{}, error)

LUA Callback : Success

func InitGlobalConfig

func InitGlobalConfig(path string) typex.RulexConfig

Init config

func NewDeviceTypeManager

func NewDeviceTypeManager() typex.DeviceRegistry

func NewRulexStore

func NewRulexStore(maxSize int) typex.XStore

func NewSourceTypeManager

func NewSourceTypeManager() typex.SourceRegistry

func NewTargetTypeManager

func NewTargetTypeManager() typex.TargetRegistry

func SetDebugMode

func SetDebugMode(EnablePProf bool)

* * 设置性能,通常用来Debug用,生产环境建议关闭 *

func SetGomaxProcs

func SetGomaxProcs(GomaxProcs int)

* * 设置go的线程,通常=0 不需要配置 *

func StartStore

func StartStore(maxSize int)

func VerifyExprSyntax

func VerifyExprSyntax(r *typex.Rule) error

* * 验证expr表达式的语法 *

func VerifyLuaSyntax

func VerifyLuaSyntax(r *typex.Rule) error

VerifyLuaSyntax Verify Lua Syntax

Types

type DeviceTypeManager

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

func (*DeviceTypeManager) All

func (rm *DeviceTypeManager) All() []*typex.XConfig

func (*DeviceTypeManager) Find

func (*DeviceTypeManager) Register

func (rm *DeviceTypeManager) Register(name typex.DeviceType, f *typex.XConfig)

type RulexStore

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

func (*RulexStore) Count

func (rs *RulexStore) Count() int

统计数量

func (*RulexStore) Delete

func (rs *RulexStore) Delete(k string) error

func (*RulexStore) FuzzyGet

func (rs *RulexStore) FuzzyGet(k string) string

模糊查询匹配 支持: *AAA AAA* A*B

func (*RulexStore) Get

func (rs *RulexStore) Get(k string) string

获取值

func (*RulexStore) Set

func (rs *RulexStore) Set(k string, v string)

设置值

func (*RulexStore) SetDuration

func (rs *RulexStore) SetDuration(k string, v string, d time.Duration)

* * 设置过期时间 *

type SourceTypeManager

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

func (*SourceTypeManager) All

func (rm *SourceTypeManager) All() []*typex.XConfig

func (*SourceTypeManager) Find

func (rm *SourceTypeManager) Find(name typex.InEndType) *typex.XConfig

func (*SourceTypeManager) Register

func (rm *SourceTypeManager) Register(name typex.InEndType, f *typex.XConfig)

type TargetTypeManager

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

func (*TargetTypeManager) All

func (rm *TargetTypeManager) All() []*typex.XConfig

func (*TargetTypeManager) Find

func (*TargetTypeManager) Register

func (rm *TargetTypeManager) Register(name typex.TargetType, f *typex.XConfig)

Jump to

Keyboard shortcuts

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