cond

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArithmeticExpression

type ArithmeticExpression struct {
	Index    int64         `json:"index"`
	Left     Expression    `json:"left"`
	Operator string        `json:"operator"`
	Right    *Expression   `json:"right,omitempty"`
	Expr     *ExpressionV2 `json:"-"` // v2 版本专用
}

ArithmeticExpression 算术表达式

func Contain

func Contain(leftValue string, rightValue interface{}) *ArithmeticExpression

func Empty

func Empty(leftValue string) *ArithmeticExpression

func Eq

func Eq(leftValue string, rightValue interface{}) *ArithmeticExpression

func Gt

func Gt(leftValue string, rightValue interface{}) *ArithmeticExpression

func Gte

func Gte(leftValue string, rightValue interface{}) *ArithmeticExpression

func HasAnyOf

func HasAnyOf(leftValue string, rightValue interface{}) *ArithmeticExpression

func HasAnyOfHierarchy

func HasAnyOfHierarchy(leftValue string, rightValue interface{}) *ArithmeticExpression

HasAnyOfHierarchy 层级查询,需要设置 ExtendLogicTags

func HasNoneOf

func HasNoneOf(leftValue string, rightValue interface{}) *ArithmeticExpression

func HasNoneOfHierarchy

func HasNoneOfHierarchy(leftValue string, rightValue interface{}) *ArithmeticExpression

HasNoneOfHierarchy 层级查询,需要设置 ExtendLogicTags

func In

func In(leftValue string, rightValue interface{}) *ArithmeticExpression

func IsOnOrAfter

func IsOnOrAfter(leftValue string, rightValue interface{}) *ArithmeticExpression

IsOnOrAfter 日期比较,晚于

func IsOnOrBefore

func IsOnOrBefore(leftValue string, rightValue interface{}) *ArithmeticExpression

IsOnOrBefore 日期比较,早于

func Lt

func Lt(leftValue string, rightValue interface{}) *ArithmeticExpression

func Lte

func Lte(leftValue string, rightValue interface{}) *ArithmeticExpression

func Neq

func Neq(leftValue string, rightValue interface{}) *ArithmeticExpression

func NewArithmeticExpression

func NewArithmeticExpression(leftValue string, operator string, rightValue interface{}) *ArithmeticExpression

func NotContain

func NotContain(leftValue string, rightValue interface{}) *ArithmeticExpression

func NotEmpty

func NotEmpty(leftValue string) *ArithmeticExpression

func NotIn

func NotIn(leftValue string, rightValue interface{}) *ArithmeticExpression

type Criterion

type Criterion struct {
	Conditions []*ArithmeticExpression `json:"conditions"`
	Logic      string                  `json:"logic"`
}

type Expression

type Expression struct {
	Type     string      `json:"type"`
	Settings SettingType `json:"settings"`
}

type ExpressionV2

type ExpressionV2 struct {
	LeftValue  string      `json:"leftValue"`
	Operator   string      `json:"operator"`
	RightValue interface{} `json:"rightValue"`
}

func NewExpressionV2

func NewExpressionV2(leftValue string, operator string, rightValue interface{}) *ExpressionV2

type FieldPath

type FieldPath struct {
	ObjectAPIName   string   `json:"objectApiName"`
	FieldAPIName    string   `json:"fieldApiName"`
	ExtendLogicTags []string `json:"extendLogicTags"`
}

type LogicalExpression

type LogicalExpression struct {
	Type                  string                  `json:"type"`
	ArithmeticExpressions []*ArithmeticExpression `json:"arithmeticExpressions"`
	LogicalExpressions    []*LogicalExpression    `json:"logicalExpressions"`
}

LogicalExpression 逻辑表达式,树状结构

func And

func And(exps ...interface{}) *LogicalExpression

And 逻辑与 @params exps:表达式列表,表达式的类型为 *LogicalExpression 或 *ArithmeticExpression,不合法的类型直接忽略 @example exps:

cond.And(...)
cond.Or(...)
cond.Eq(...)
cond.Gt(...)

@return 返回逻辑表达式

func NewLogicalExpression

func NewLogicalExpression(logicType string, expressions []*ArithmeticExpression, logics []*LogicalExpression) *LogicalExpression

func Or

func Or(exps ...interface{}) *LogicalExpression

Or 逻辑或 @params exps:表达式列表,表达式的类型为 *LogicalExpression 或 *ArithmeticExpression,不合法的类型直接忽略 @example exps:

cond.And(...)
cond.Or(...)
cond.Eq(...)
cond.Gt(...)

@return 返回逻辑表达式

func (*LogicalExpression) AddArithmeticExpression

func (l *LogicalExpression) AddArithmeticExpression(exp *ArithmeticExpression)

func (*LogicalExpression) AddLogicalExpression

func (l *LogicalExpression) AddLogicalExpression(exp *LogicalExpression)

type SettingType

type SettingType struct {
	Data      interface{}  `json:"data,omitempty"`
	FieldPath []*FieldPath `json:"fieldPath,omitempty"`
}

Jump to

Keyboard shortcuts

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