condition/contracts/contracts.go
2024-05-09 09:26:57 +08:00

37 lines
1.0 KiB
Go

package contracts
import (
"git.fsdpf.net/go/condition"
"git.fsdpf.net/go/db"
)
type Condition interface {
Type() condition.ConditionType
IsEmpty() bool
IsNotEmpty() bool
IsAlwaysRight() bool
ToSql(condition.ConditionTokenValue) db.Expression
AppendTo(Condition)
SetExpr(ConditionExpr) Condition
SetCondition(Condition) Condition
SetMatchPrefix(string) Condition
GetFields(operator condition.ConditionOperator, types ...condition.ConditionTokenType) map[string]string
GetFieldsValue(m condition.ConditionTokenValue, isWithResource bool) map[string]any
}
type ConditionExpr interface {
GetField() string
GetFieldResource() string
GetOperator() condition.ConditionOperator
SetMatchPrefix(string) ConditionExpr
AppendTo(Condition)
ToSql(m condition.ConditionTokenValue) db.Expression
GetTokenName() string
GetTokenType() condition.ConditionTokenType
GetTokenValue(condition.ConditionTokenValue) any
GetTokenSqlValue(condition.ConditionTokenValue) string
IsIgnoreEmptyParma(condition.ConditionTokenValue) bool
}