[feat] 将 ModelParam 独立拆分

This commit is contained in:
what 2023-06-13 18:01:36 +08:00
parent cffbf8eef0
commit cd91c63096

17
orm.go
View File

@ -116,11 +116,9 @@ type Join interface {
}
type Model interface {
Relation
ModelParam
GetCode() string
GetPrimaryKey() string
GetParam(k string) GlobalParams
GetParamWithPrefix(k string, prefix string) GlobalParams
GetGlobalParamsUser() User
GetQueryFieldsStruct(extends ...reflect.StructField) any
GetQueryFieldsSliceStruct(fields ...reflect.StructField) any
GetAttribute() map[string]any
@ -148,6 +146,11 @@ type Model interface {
// Exists() (bool, error)
}
type ModelParam interface {
GetParam(k string) GlobalParams
GetGlobalParamsUser() User
}
type Condition interface {
Type() ConditionType
IsEmpty() bool
@ -170,12 +173,12 @@ type ConditionExpr interface {
SetMatchPrefix(string) ConditionExpr
AppendTo(Condition)
ToSql(m Model) db.Expression
ToSql(m ModelParam) db.Expression
GetTokenName() string
GetTokenType() ConditionTokenType
GetTokenValue(Model) any
GetTokenSqlValue(Model) string
IsIgnoreEmptyParma(Model) bool
GetTokenValue(ModelParam) any
GetTokenSqlValue(ModelParam) string
IsIgnoreEmptyParma(ModelParam) bool
}
type QueryField interface {