flow

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LIKE       = Operator{"LIKE", "文本包含", String, false, 10}
	IN_LIKE    = Operator{"IN_LIKE", "文本包含", StringList, false, 20}
	IN         = Operator{"IN", "IN", StringList, false, 30}
	NOT_IN     = Operator{"NOT_IN", "非IN", StringList, false, 30}
	SAME       = Operator{"SAME", "完全匹配", String, false, 100}
	EQ         = Operator{"EQ", "数值等于", Number, false, 150}
	NE         = Operator{"NE", "数值不等于", Number, false, 200}
	GT         = Operator{"GT", "数值大于", Number, false, 300}
	GTE        = Operator{"GTE", "数值大于等于", Number, false, 400}
	LT         = Operator{"LT", "数值小于", Number, false, 500}
	LTE        = Operator{"LTE", "数值小于等于", Number, false, 600}
	NOT_EMPTY  = Operator{"NOT_EMPTY", "存在", Single, false, 0}
	EMPTY      = Operator{"EMPTY", "不存在", Single, false, 1}
	BETWEEN    = Operator{"BETWEEN", "数值介于", NumberTuple, false, 700}
	EXISTS     = Operator{"EXISTS", "存在", Single, false, 0}
	NON_EXISTS = Operator{"NON_EXISTS", "不存在", Single, false, 1}
)

预定义的 Operator 实例

Functions

func CompareNumeric

func CompareNumeric(op, ks, vs string) bool

func ConditionValidator

func ConditionValidator(renderModel map[string]any, condition Condition) bool

func Eval

func Eval(o string, k string, v string) bool

Types

type Condition

type Condition struct {
	Key       string         `json:"key,omitempty"`      // 条件键
	Operator  string         `json:"operator,omitempty"` // 操作符
	Value     any            `json:"value,omitempty"`    // 值
	Label     string         `json:"label,omitempty"`    // 标签
	Script    string         `json:"script,omitempty"`   // 脚本
	Connector LogicConnector `json:"connector,omitempty"`
	Children  []Condition    `json:"children,omitempty"`
}

Condition 结构体

type DictValueType

type DictValueType string
const (
	String      DictValueType = "STRING"
	StringList  DictValueType = "STRING_LIST"
	Number      DictValueType = "NUMBER"
	NumberTuple DictValueType = "NUMBER_TUPLE"
	Single      DictValueType = "SINGLE"
	JSON        DictValueType = "JSON"
	JSON_ARRAY  DictValueType = "JSON_ARRAY"
)

type LogicConnector added in v0.1.5

type LogicConnector int
const (
	AND LogicConnector = iota
	OR
	NOT
)

type Operator

type Operator struct {
	Value     string        `json:"value,omitempty"`
	Desc      string        `json:"desc,omitempty"`
	ValueType DictValueType `json:"value_type,omitempty"`
	Disabled  bool          `json:"disabled,omitempty"`
	Order     int           `json:"order,omitempty"`
}

Operator 枚举

Jump to

Keyboard shortcuts

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