[feat] 重命名 ConditionTokenType => TokenType

This commit is contained in:
what 2024-05-09 10:47:51 +08:00
parent dd56166a13
commit 9694d90332
3 changed files with 11 additions and 11 deletions

View File

@ -189,7 +189,7 @@ func (this Condition) GetFieldsValue(m TokenValue, isWithResource bool) (result
* @param contracts.ConditionTokenType types
* @return map[string][string] // 如: {"TestA.field_a": "param"}
*/
func (this Condition) GetFields(operator ConditionOperator, types ...ConditionTokenType) map[string]string {
func (this Condition) GetFields(operator ConditionOperator, types ...TokenType) map[string]string {
result := make(map[string]string)
if this.IsEmpty() {

View File

@ -12,14 +12,14 @@ import (
"github.com/spf13/cast"
)
type TokenType string
type ConditionOperator string
type ConditionTokenType string
const (
SQL ConditionTokenType = "sql"
FUNC ConditionTokenType = "func"
PARAM ConditionTokenType = "param"
STRING ConditionTokenType = "string"
SQL TokenType = "sql"
FUNC TokenType = "func"
PARAM TokenType = "param"
STRING TokenType = "string"
)
const (
@ -54,7 +54,7 @@ type ConditionExpr struct {
fieldSqlFunc string
fieldSqlFuncParam string
ignoreEmptyParma bool
tokenType ConditionTokenType
tokenType TokenType
token string
matchPrefix string // 匹配前缀
}
@ -147,7 +147,7 @@ func (this ConditionExpr) GetTokenName() string {
return this.token
}
func (this ConditionExpr) GetTokenType() ConditionTokenType {
func (this ConditionExpr) GetTokenType() TokenType {
return this.tokenType
}
@ -247,7 +247,7 @@ func Operator(v ConditionOperator) ExprOption {
}
}
func Token(token string, tType ConditionTokenType) ExprOption {
func Token(token string, tType TokenType) ExprOption {
return func(option *ConditionExpr) {
option.token = token
option.tokenType = tType

View File

@ -15,7 +15,7 @@ type Condition interface {
SetExpr(ConditionExpr) Condition
SetCondition(Condition) Condition
SetMatchPrefix(string) Condition
GetFields(operator condition.ConditionOperator, types ...condition.ConditionTokenType) map[string]string
GetFields(operator condition.ConditionOperator, types ...condition.TokenType) map[string]string
GetFieldsValue(m condition.TokenValue, isWithResource bool) map[string]any
}
@ -29,7 +29,7 @@ type ConditionExpr interface {
AppendTo(Condition)
ToSql(m condition.TokenValue) db.Expression
GetTokenName() string
GetTokenType() condition.ConditionTokenType
GetTokenType() condition.TokenType
GetTokenValue(condition.TokenValue) any
GetTokenSqlValue(condition.TokenValue) string
IsIgnoreEmptyParma(condition.TokenValue) bool