[feat] 重新梳理依赖
This commit is contained in:
+16
-16
@@ -5,16 +5,16 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"git.fsdpf.net/go/contracts"
|
||||
"git.fsdpf.net/go/contracts/res_type"
|
||||
"git.fsdpf.net/go/db"
|
||||
"git.fsdpf.net/go/req"
|
||||
)
|
||||
|
||||
type QueryField struct {
|
||||
ResField
|
||||
typ contracts.QueryDataType `db:"dataType"`
|
||||
alias string `db:"alias"`
|
||||
isExpr bool `db:"isExpr"`
|
||||
typ req.RouteParamType `db:"dataType"`
|
||||
alias string `db:"alias"`
|
||||
isExpr bool `db:"isExpr"`
|
||||
isOmitempty bool
|
||||
ignored bool
|
||||
}
|
||||
@@ -35,20 +35,20 @@ func (this QueryField) IsOmitempty() bool {
|
||||
return this.isOmitempty
|
||||
}
|
||||
|
||||
func (this QueryField) Type() contracts.QueryDataType {
|
||||
func (this QueryField) Type() req.RouteParamType {
|
||||
return this.typ
|
||||
}
|
||||
|
||||
func (this *QueryField) SetOptions(options int) contracts.QueryField {
|
||||
if options&contracts.QueryField_IsExpr != 0 {
|
||||
func (this *QueryField) SetOptions(options byte) req.QueryField {
|
||||
if options&req.IsExpr != 0 {
|
||||
this.isExpr = true
|
||||
}
|
||||
|
||||
if options&contracts.QueryField_IsOmitempty != 0 {
|
||||
if options&req.IsOmitempty != 0 {
|
||||
this.isOmitempty = true
|
||||
}
|
||||
|
||||
if options&contracts.QueryField_Ignored != 0 {
|
||||
if options&req.Ignored != 0 {
|
||||
this.ignored = true
|
||||
}
|
||||
|
||||
@@ -101,19 +101,19 @@ func (this *QueryField) ToStructField(tags ...string) reflect.StructField {
|
||||
}
|
||||
|
||||
switch this.typ {
|
||||
case contracts.QueryDataType_String:
|
||||
case req.ReqString:
|
||||
typ = reflect.TypeOf(string(""))
|
||||
case contracts.QueryDataType_Number:
|
||||
case req.ReqNumber:
|
||||
typ = reflect.TypeOf(res_type.ResFieldByNumber(0))
|
||||
case contracts.QueryDataType_Integer:
|
||||
case req.ReqInteger:
|
||||
typ = reflect.TypeOf(res_type.ResFieldByInteger(0))
|
||||
case contracts.QueryDataType_Float:
|
||||
case req.ReqFloat:
|
||||
typ = reflect.TypeOf(res_type.ResFieldByFloat(0))
|
||||
case contracts.QueryDataType_Bool:
|
||||
case req.ReqBool:
|
||||
typ = reflect.TypeOf(true)
|
||||
case contracts.QueryDataType_Array:
|
||||
case req.ReqArray:
|
||||
typ = reflect.TypeOf([]any{})
|
||||
case contracts.QueryDataType_Json:
|
||||
case req.ReqJson:
|
||||
typ = reflect.TypeOf(map[string]any{})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user