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