condition/contracts/contracts.go

37 lines
965 B
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.TokenValue) db.Expression
AppendTo(Condition)
SetExpr(ConditionExpr) Condition
SetCondition(Condition) Condition
SetMatchPrefix(string) Condition
GetFields(operator condition.ConditionOperator, types ...condition.TokenType) map[string]string
GetFieldsValue(m condition.TokenValue, isWithResource bool) map[string]any
}
type ConditionExpr interface {
GetField() string
GetFieldResource() string
GetOperator() condition.ConditionOperator
SetMatchPrefix(string) ConditionExpr
AppendTo(Condition)
ToSql(m condition.TokenValue) db.Expression
GetTokenName() string
GetTokenType() condition.TokenType
GetTokenValue(condition.TokenValue) any
GetTokenSqlValue(condition.TokenValue) string
IsIgnoreEmptyParma(condition.TokenValue) bool
}