[feat] 重命名 ConditionTokenValue => TokenValue
This commit is contained in:
parent
a871ccfa75
commit
f79e122b40
@ -93,7 +93,7 @@ func (this Condition) IsAlwaysRight() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 生成 SQL 语句
|
// 生成 SQL 语句
|
||||||
func (this Condition) ToSql(m ConditionTokenValue) db.Expression {
|
func (this Condition) ToSql(m TokenValue) db.Expression {
|
||||||
conditions := []string{}
|
conditions := []string{}
|
||||||
// 表达式
|
// 表达式
|
||||||
for _, item := range this.exprs {
|
for _, item := range this.exprs {
|
||||||
@ -157,7 +157,7 @@ func (this *Condition) SetMatchPrefix(prefix string) *Condition {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this Condition) GetFieldsValue(m ConditionTokenValue, isWithResource bool) (result map[string]any) {
|
func (this Condition) GetFieldsValue(m TokenValue, isWithResource bool) (result map[string]any) {
|
||||||
if this.IsEmpty() {
|
if this.IsEmpty() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ const (
|
|||||||
|
|
||||||
type ExprOption func(option *ConditionExpr)
|
type ExprOption func(option *ConditionExpr)
|
||||||
|
|
||||||
type ConditionTokenValue interface {
|
type TokenValue interface {
|
||||||
GetParam(k string) req.GlobalParams
|
GetParam(k string) req.GlobalParams
|
||||||
GetGlobalParamsUser() req.User
|
GetGlobalParamsUser() req.User
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ func (this *ConditionExpr) AppendTo(c *Condition) {
|
|||||||
this.parent = c
|
this.parent = c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this ConditionExpr) ToSql(m ConditionTokenValue) db.Expression {
|
func (this ConditionExpr) ToSql(m TokenValue) db.Expression {
|
||||||
first := "`" + this.fieldResource + "`.`" + this.field + "`"
|
first := "`" + this.fieldResource + "`.`" + this.field + "`"
|
||||||
|
|
||||||
if strings.Contains(this.field, "->") {
|
if strings.Contains(this.field, "->") {
|
||||||
@ -151,7 +151,7 @@ func (this ConditionExpr) GetTokenType() ConditionTokenType {
|
|||||||
return this.tokenType
|
return this.tokenType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ConditionExpr) GetTokenSqlValue(m ConditionTokenValue) string {
|
func (this *ConditionExpr) GetTokenSqlValue(m TokenValue) string {
|
||||||
if this.GetTokenType() == SQL {
|
if this.GetTokenType() == SQL {
|
||||||
return this.token
|
return this.token
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ func (this *ConditionExpr) GetTokenSqlValue(m ConditionTokenValue) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this ConditionExpr) GetTokenValue(m ConditionTokenValue) any {
|
func (this ConditionExpr) GetTokenValue(m TokenValue) any {
|
||||||
switch this.GetTokenType() {
|
switch this.GetTokenType() {
|
||||||
case PARAM:
|
case PARAM:
|
||||||
if this.matchPrefix != "" {
|
if this.matchPrefix != "" {
|
||||||
@ -216,7 +216,7 @@ func (this ConditionExpr) GetTokenValue(m ConditionTokenValue) any {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this ConditionExpr) IsIgnoreEmptyParma(m ConditionTokenValue) bool {
|
func (this ConditionExpr) IsIgnoreEmptyParma(m TokenValue) bool {
|
||||||
if !this.ignoreEmptyParma {
|
if !this.ignoreEmptyParma {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ type EngineCase[T any] struct {
|
|||||||
cb func(data T, g req.GlobalParams) error
|
cb func(data T, g req.GlobalParams) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this EngineCase[T]) ToSql(param condition.ConditionTokenValue) db.Expression {
|
func (this EngineCase[T]) ToSql(param condition.TokenValue) db.Expression {
|
||||||
if this.predicate == nil || this.predicate.IsEmpty() {
|
if this.predicate == nil || this.predicate.IsEmpty() {
|
||||||
return db.Raw("NULL")
|
return db.Raw("NULL")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user