cond

package
v0.0.36-beta.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 4 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 ArithmeticExpressionV3 added in v0.0.35

type ArithmeticExpressionV3 struct {
	Index    int64         `json:"index"`
	Left     ExpressionV3  `json:"left"`
	Operator string        `json:"operator"`
	Right    *ExpressionV3 `json:"right,omitempty"`
}

type Criterion

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

func (*Criterion) ToCriterionV3 added in v0.0.35

func (c *Criterion) ToCriterionV3() (*CriterionV3, error)

type CriterionV3 added in v0.0.35

type CriterionV3 struct {
	Conditions []*ArithmeticExpressionV3 `json:"conditions"`
	Expression string                    `json:"expression"`
}

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 ExpressionV3 added in v0.0.35

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

type FieldPath

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

type FieldPathV3 added in v0.0.35

type FieldPathV3 struct {
	ObjectAPIName string `json:"objectApiName"`
	FieldAPIName  string `json:"fieldApiName"`
}

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 SettingLeftTypeV3 added in v0.0.35

type SettingLeftTypeV3 struct {
	FieldPath []*FieldPathV3 `json:"fieldPath,omitempty"`
}

type SettingRightTypeV3 added in v0.0.35

type SettingRightTypeV3 struct {
	Data interface{} `json:"data,omitempty"`
}

type SettingType

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

func (*SettingType) ToLeftSettingTypeV3 added in v0.0.35

func (s *SettingType) ToLeftSettingTypeV3() *SettingLeftTypeV3

func (*SettingType) ToRightSettingTypeV3 added in v0.0.35

func (s *SettingType) ToRightSettingTypeV3() *SettingRightTypeV3

Jump to

Keyboard shortcuts

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