2024-05-08 22:36:43 +08:00
|
|
|
package contracts
|
|
|
|
|
|
|
|
import (
|
2024-05-09 09:26:57 +08:00
|
|
|
"git.fsdpf.net/go/condition"
|
2024-05-08 22:36:43 +08:00
|
|
|
"git.fsdpf.net/go/db"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Condition interface {
|
2024-05-09 09:26:57 +08:00
|
|
|
Type() condition.ConditionType
|
2024-05-08 22:36:43 +08:00
|
|
|
IsEmpty() bool
|
|
|
|
IsNotEmpty() bool
|
|
|
|
IsAlwaysRight() bool
|
2024-05-09 09:26:57 +08:00
|
|
|
ToSql(condition.ConditionTokenValue) db.Expression
|
2024-05-08 22:36:43 +08:00
|
|
|
AppendTo(Condition)
|
|
|
|
SetExpr(ConditionExpr) Condition
|
|
|
|
SetCondition(Condition) Condition
|
|
|
|
SetMatchPrefix(string) Condition
|
2024-05-09 09:26:57 +08:00
|
|
|
GetFields(operator condition.ConditionOperator, types ...condition.ConditionTokenType) map[string]string
|
|
|
|
GetFieldsValue(m condition.ConditionTokenValue, isWithResource bool) map[string]any
|
2024-05-08 22:36:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type ConditionExpr interface {
|
|
|
|
GetField() string
|
|
|
|
GetFieldResource() string
|
2024-05-09 09:26:57 +08:00
|
|
|
GetOperator() condition.ConditionOperator
|
2024-05-08 22:36:43 +08:00
|
|
|
|
|
|
|
SetMatchPrefix(string) ConditionExpr
|
|
|
|
|
|
|
|
AppendTo(Condition)
|
2024-05-09 09:26:57 +08:00
|
|
|
ToSql(m condition.ConditionTokenValue) db.Expression
|
2024-05-08 22:36:43 +08:00
|
|
|
GetTokenName() string
|
2024-05-09 09:26:57 +08:00
|
|
|
GetTokenType() condition.ConditionTokenType
|
|
|
|
GetTokenValue(condition.ConditionTokenValue) any
|
|
|
|
GetTokenSqlValue(condition.ConditionTokenValue) string
|
|
|
|
IsIgnoreEmptyParma(condition.ConditionTokenValue) bool
|
2024-05-08 22:36:43 +08:00
|
|
|
}
|