condition/contracts/contracts.go

37 lines
983 B
Go
Raw Normal View History

package contracts
import (
2024-05-09 09:26:57 +08:00
"git.fsdpf.net/go/condition"
"git.fsdpf.net/go/db"
)
type Condition interface {
2024-05-09 09:26:57 +08:00
Type() condition.ConditionType
IsEmpty() bool
IsNotEmpty() bool
IsAlwaysRight() bool
ToSql(condition.TokenValue) db.Expression
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.TokenValue, isWithResource bool) map[string]any
}
type ConditionExpr interface {
GetField() string
GetFieldResource() string
2024-05-09 09:26:57 +08:00
GetOperator() condition.ConditionOperator
SetMatchPrefix(string) ConditionExpr
AppendTo(Condition)
ToSql(m condition.TokenValue) db.Expression
GetTokenName() string
2024-05-09 09:26:57 +08:00
GetTokenType() condition.ConditionTokenType
GetTokenValue(condition.TokenValue) any
GetTokenSqlValue(condition.TokenValue) string
IsIgnoreEmptyParma(condition.TokenValue) bool
}