ruleengine

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MulanPSL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintLn

func PrintLn(s ...any) (int, error)

Types

type IchubContext

type IchubContext struct {
	DataContext *context.DataContext `json:"-"`

	In  IchubParams
	Out IchubParams

	User    ruledomain.IchubUser    `json:"Empty,omitempty"`
	Shop    ruledomain.IchubShop    `json:"Empty,omitempty"`
	Account ruledomain.IchubAccount `json:"Empty,omitempty"`
}

func NewIchubContext

func NewIchubContext() *IchubContext

func (*IchubContext) Add

func (p *IchubContext) Add() *IchubContext

func (*IchubContext) AddBy

func (p *IchubContext) AddBy(DataContext *context.DataContext) *IchubContext

func (*IchubContext) GetIn

func (p *IchubContext) GetIn() *IchubParams

func (*IchubContext) GetOut

func (p *IchubContext) GetOut() *IchubParams

func (*IchubContext) GetParam

func (p *IchubContext) GetParam(key string) *IchubParam

func (*IchubContext) GetParamAny

func (p *IchubContext) GetParamAny(key string) any

func (*IchubContext) GetReturnValue

func (p *IchubContext) GetReturnValue() any

func (*IchubContext) Info

func (p *IchubContext) Info() string

func (*IchubContext) Log

func (p *IchubContext) Log()

func (*IchubContext) Param2Int

func (p *IchubContext) Param2Int(key string) int

func (*IchubContext) Param2Int32

func (p *IchubContext) Param2Int32(key string) int32

func (*IchubContext) Param2Int64

func (p *IchubContext) Param2Int64(key string) int64

func (*IchubContext) PrintLn

func (p *IchubContext) PrintLn(s ...any)

func (*IchubContext) PrintName

func (p *IchubContext) PrintName(name string)

func (*IchubContext) SetIn

func (p *IchubContext) SetIn(in *IchubParams)

func (*IchubContext) SetInParam

func (p *IchubContext) SetInParam(key string, value any)

func (*IchubContext) SetOut

func (p *IchubContext) SetOut(out *IchubParams)

func (*IchubContext) SetOutParam

func (p *IchubContext) SetOutParam(key string, value any)

func (*IchubContext) SetReturnValue

func (p *IchubContext) SetReturnValue(value int64)

func (*IchubContext) ToInt

func (p *IchubContext) ToInt(v any) int

func (*IchubContext) ToInt32

func (p *IchubContext) ToInt32(v any) int32

func (*IchubContext) ToInt64

func (p *IchubContext) ToInt64(v any) int64

func (*IchubContext) ToJsonStr

func (p *IchubContext) ToJsonStr() string

type IchubEngine

type IchubEngine struct {
	Ctxt         *context.DataContext
	IchubContext *IchubContext
}

func NewIchubEngine

func NewIchubEngine() *IchubEngine

func (*IchubEngine) Add

func (icEngine *IchubEngine) Add(key string, obj interface{})

func (*IchubEngine) DoEngine

func (icEngine *IchubEngine) DoEngine(rule string, param string) (*IchubEngine, error)

func (*IchubEngine) DoEngineData

func (icEngine *IchubEngine) DoEngineData(ruleData *RuleData) (*IchubEngine, error)

func (*IchubEngine) DoIchubEngine

func (icEngine *IchubEngine) DoIchubEngine(in *IchubParams, rule string) (*IchubEngine, error)

func (*IchubEngine) Execute

func (icEngine *IchubEngine) Execute(ruleBuilder *builder.RuleBuilder) (*engine.Gengine, error)

func (*IchubEngine) ExecuteConcurrent

func (icEngine *IchubEngine) ExecuteConcurrent(ruleBuilder *builder.RuleBuilder) (*engine.Gengine, error)

ExecuteConcurrent

func (*IchubEngine) ExecuteRule

func (icEngine *IchubEngine) ExecuteRule(rule string, params IchubParams) (eng *engine.Gengine, err error)

func (*IchubEngine) GetReturnValue

func (icEngine *IchubEngine) GetReturnValue() any

func (*IchubEngine) Ini

func (icEngine *IchubEngine) Ini() *IchubContext

func (*IchubEngine) Log

func (icEngine *IchubEngine) Log()

func (*IchubEngine) NewDataContext

func (icEngine *IchubEngine) NewDataContext() (dataContext *context.DataContext)

func (*IchubEngine) NewDataContextBy

func (icEngine *IchubEngine) NewDataContextBy(ctxtmap *map[string]any) (dataContext *context.DataContext)

func (*IchubEngine) NewIchubContext

func (icEngine *IchubEngine) NewIchubContext() *IchubContext

func (*IchubEngine) NewRuleBuilder

func (icEngine *IchubEngine) NewRuleBuilder(dataContext *context.DataContext, rule string) (*builder.RuleBuilder, error)

func (*IchubEngine) ReadFile

func (icEngine *IchubEngine) ReadFile(filename string) (rule string)

func (*IchubEngine) SetIn

func (icEngine *IchubEngine) SetIn(in *IchubParams)

func (*IchubEngine) TestEngine

func (icEngine *IchubEngine) TestEngine(rulefile string, paramfile string) (*IchubEngine, error)

func (*IchubEngine) TestEngineFile

func (icEngine *IchubEngine) TestEngineFile(rulefile *RuleFile) (*IchubEngine, error)

type IchubParam

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

@Title 文件名称: ichub_param.go @Description 描述: 有芯规则引擎执行的参数值对象

@Author 作者: leijianming@163.com 时间(2024-01-31 22:38:21) @Update 作者: leijianming@163.com 时间(2024-01-31 22:38:21)

func (*IchubParam) From

func (p *IchubParam) From(v any) *IchubParam

func (*IchubParam) ToBool

func (p *IchubParam) ToBool() bool

规则体支持的基础数据类型 string bool int, int8, int16, int32, int64 uint, uint8, uint16,uint32, uint64 float32, float64

func (*IchubParam) ToByte

func (p *IchubParam) ToByte() byte

func (*IchubParam) ToBytes

func (p *IchubParam) ToBytes() []byte

func (*IchubParam) ToFloat32

func (p *IchubParam) ToFloat32() float32

func (*IchubParam) ToFloat64

func (p *IchubParam) ToFloat64() float64

func (*IchubParam) ToInt16

func (p *IchubParam) ToInt16() int16

func (*IchubParam) ToInt32

func (p *IchubParam) ToInt32() int32

func (*IchubParam) ToInt64

func (p *IchubParam) ToInt64() int64

func (*IchubParam) ToInt8

func (p *IchubParam) ToInt8() int8

func (*IchubParam) ToString

func (p *IchubParam) ToString() string

func (*IchubParam) ToUInt

func (p *IchubParam) ToUInt() uint

func (*IchubParam) ToUInt16

func (p *IchubParam) ToUInt16() uint16

func (*IchubParam) ToUInt32

func (p *IchubParam) ToUInt32() uint32

func (*IchubParam) ToUInt64

func (p *IchubParam) ToUInt64() uint64

type IchubParams

type IchubParams map[string]any

@Title 文件名称: ichub_params.go @Description 描述: 有芯规则引擎执行的参数聚合值对象

@Author 作者: leijianming@163.com 时间(2024-01-31 22:38:21) @Update 作者: leijianming@163.com 时间(2024-01-31 22:38:21)

func (*IchubParams) FromJson

func (p *IchubParams) FromJson(jsonstr string) error

func (*IchubParams) GetParam

func (p *IchubParams) GetParam(key string) *IchubParam

func (*IchubParams) GetParamByte

func (p *IchubParams) GetParamByte(key string) byte

func (*IchubParams) GetParamBytes

func (p *IchubParams) GetParamBytes(key string) []byte

func (*IchubParams) GetParamFloat32

func (p *IchubParams) GetParamFloat32(key string) float32

func (*IchubParams) GetParamFloat64

func (p *IchubParams) GetParamFloat64(key string) float64

func (*IchubParams) GetParamInt

func (p *IchubParams) GetParamInt(key string) int

func (*IchubParams) GetParamInt16

func (p *IchubParams) GetParamInt16(key string) int16

func (*IchubParams) GetParamInt32

func (p *IchubParams) GetParamInt32(key string) int32

func (*IchubParams) GetParamInt64

func (p *IchubParams) GetParamInt64(key string) int64

func (*IchubParams) GetParamInt8

func (p *IchubParams) GetParamInt8(key string) int8

func (*IchubParams) GetParamString

func (p *IchubParams) GetParamString(key string) string

func (*IchubParams) GetParamUInt

func (p *IchubParams) GetParamUInt(key string) uint

func (*IchubParams) GetParamUInt16

func (p *IchubParams) GetParamUInt16(key string) uint16

func (*IchubParams) GetParamUInt32

func (p *IchubParams) GetParamUInt32(key string) uint32

func (*IchubParams) GetParamUInt64

func (p *IchubParams) GetParamUInt64(key string) uint64

func (*IchubParams) GetParamUInt8

func (p *IchubParams) GetParamUInt8(key string) uint8

func (*IchubParams) GetReturnValue

func (p *IchubParams) GetReturnValue() any

func (*IchubParams) Log

func (p *IchubParams) Log()

func (*IchubParams) SetParam

func (p *IchubParams) SetParam(key string, value any)

func (*IchubParams) SetParamString

func (p *IchubParams) SetParamString(key string, value any)

func (*IchubParams) SetReturnValue

func (p *IchubParams) SetReturnValue(value any)

func (*IchubParams) ToInt

func (p *IchubParams) ToInt(v any) int

func (*IchubParams) ToJson

func (p *IchubParams) ToJson() string

type RuleData

type RuleData struct {
	Rule   string
	Param  string
	Exp    string
	Result string
}

@Title 文件名称: ichub_ruledata.go @Description 描述: 有芯规则引擎执行的数据值对象

@Author 作者: leijianming@163.com 时间(2024-01-31 22:38:21) @Update 作者: leijianming@163.com 时间(2024-01-31 22:38:21)

func (*RuleData) Log

func (rf *RuleData) Log() *RuleData

Log 打印规则引擎入参数据

type RuleFile

type RuleFile struct {
	Rule   string
	Param  string
	Result string
	Exp    string
}

@Title 文件名称: ichub_rulefile.go @Description 描述: 有芯规则引擎执行的数据文件值对象

@Author 作者: leijianming@163.com 时间(2024-01-31 22:38:21) @Update 作者: leijianming@163.com 时间(2024-01-31 22:38:21)

func (*RuleFile) Log

func (rf *RuleFile) Log()

func (*RuleFile) Read2Data

func (rf *RuleFile) Read2Data() *RuleData

Jump to

Keyboard shortcuts

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