[feat] 移除 ResFieldByMap, ResFieldByAnys 类型

This commit is contained in:
what 2023-06-23 00:10:24 +08:00
parent 88ed380018
commit 6ccef0fbb8
25 changed files with 416 additions and 459 deletions

View File

@ -1,8 +1,19 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type DataListOrder struct {
Sql string `json:"sql"`
Type string `json:"type"`
Direction string `json:"direction"`
}
type DataListGroup struct {
Sql string `json:"sql"`
Type string `json:"type"`
}
type XlsxImportConfig struct {
Mode int `json:"mode"`
UniqueImportFields []string `json:"uniqueImportFields"`
}
type DataList struct {
Uuid string `db:"uuid"`
@ -16,27 +27,27 @@ type DataList struct {
OperationColumnWidth int `db:"operationColumnWidth"` // 操作列宽度
IsPaginate bool `db:"isPaginate"` // 是否分页
IsTreeData bool `db:"isTreeData"` // 是否使用树形列表
TreeDataConfig res_type.ResFieldByMap `db:"treeDataConfig"` // 树形列表配置
TreeDataConfig map[string]any `db:"treeDataConfig"` // 树形列表配置
IsExpandedRow string `db:"isExpandedRow"` // 列表明细控件
ExpandedRowConfig res_type.ResFieldByMap `db:"expandedRowConfig"` // 列表明细控件配置
ExpandedRowConfig map[string]any `db:"expandedRowConfig"` // 列表明细控件配置
IsTreeSider bool `db:"isTreeSider"` // 是否打开侧边栏侧边栏
TreeSiderConfig res_type.ResFieldByMap `db:"treeSiderConfig"` // 侧边栏设置
TreeSiderConfig map[string]any `db:"treeSiderConfig"` // 侧边栏设置
IsDynamicRefresh bool `db:"isDynamicRefresh"` // 是否启用动态刷新
PageSize int `db:"pagesize"` // 分页大小
IsAuxiliaryPanel bool `db:"isAuxiliaryPanel"` // 是否使用附属面板
AuxiliaryPanelConfig res_type.ResFieldByMap `db:"auxiliaryPanelConfig"` // 附属面板配置
SortConfig res_type.ResFieldByAnys `db:"sortConfig"` // 排序设置
FieldsSort res_type.ResFieldByAnys `db:"fieldsSort"` // 字段排序
GroupConfig res_type.ResFieldByAnys `db:"groupConfig"` // 分组设置
XlsxFieldsSort res_type.ResFieldByAnys `db:"xlsxFieldsSort"` // 字段排序
XlsxImportFieldsSort res_type.ResFieldByAnys `db:"xlsxImportFieldsSort"` // 字段排序
XlsxImportConfig res_type.ResFieldByMap `db:"xlsxImportConfig"` // 导入设置
TabsSort res_type.ResFieldByAnys `db:"tabsSort"` // 标签排序
OperationsSort res_type.ResFieldByAnys `db:"operationsSort"` // 按钮排序
FsmConfig res_type.ResFieldByAnys `db:"fsmConfig"` // FSM设置
ApprovalConfig res_type.ResFieldByAnys `db:"approvalConfig"` // 审批设置
UniqueImportFields res_type.ResFieldByAnys `db:"uniqueImportFields"` // 导入字段唯一效验
Roles res_type.ResFieldByAnys `db:"roles"` // 列表权限
AuxiliaryPanelConfig map[string]any `db:"auxiliaryPanelConfig"` // 附属面板配置
SortConfig []DataListOrder `db:"sortConfig"` // 排序设置
FieldsSort []string `db:"fieldsSort"` // 字段排序
GroupConfig []DataListGroup `db:"groupConfig"` // 分组设置
XlsxFieldsSort []string `db:"xlsxFieldsSort"` // 字段排序
XlsxImportFieldsSort []string `db:"xlsxImportFieldsSort"` // 字段排序
XlsxImportConfig XlsxImportConfig `db:"xlsxImportConfig"` // 导入设置
TabsSort []string `db:"tabsSort"` // 标签排序
OperationsSort []string `db:"operationsSort"` // 按钮排序
FsmConfig [][2]any `db:"fsmConfig"` // FSM设置
ApprovalConfig [][2]any `db:"approvalConfig"` // 审批设置
UniqueImportFields []string `db:"uniqueImportFields"` // 导入字段唯一效验
Roles []string `db:"roles"` // 列表权限
IsAuthDB int `db:"is_auth_db"` // 启用权限过滤
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`

View File

@ -1,13 +1,9 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type DataListField struct {
Uuid string `db:"uuid"`
DataListUuid string `db:"data_list_uuid"` // 所属列表 UUID
Title res_type.ResFieldByString `db:"title"` // 列表标题
Title string `db:"title"` // 列表标题
Code string `db:"code"` // 字段名称
CodeResource string `db:"codeResource"` // 字段所属资源
Alias string `db:"alias"` // 字段别名
@ -19,16 +15,16 @@ type DataListField struct {
Align string `db:"align"` // 对齐方式
IsShow int `db:"isShow"` // 是否显示
WidgetByJs string `db:"widgetByJs"` // 前端数据渲染控件
WidgetByJsSetting res_type.ResFieldByMap `db:"widgetByJsSetting"` // 前端数据渲染控件设置参数
WidgetByJsSetting map[string]any `db:"widgetByJsSetting"` // 前端数据渲染控件设置参数
IsSearch bool `db:"isSearch"` // 允许关键字搜索
IsVirtual bool `db:"isVirtual"` // 是否虚拟字段
IsSort bool `db:"isSort"` // 允许字段排序
EditableByJs string `db:"editableByJs"` // 字段更新组件
EditableByJsSetting res_type.ResFieldByMap `db:"editableByJsSetting"` // 字段更新组件设置
EditableByJsSetting map[string]any `db:"editableByJsSetting"` // 字段更新组件设置
FilterByJs string `db:"filterByJs"` // 字段筛选组件
FilterByJsSetting res_type.ResFieldByMap `db:"filterByJsSetting"` // 字段筛选组件设置参数
FilterByJsSetting map[string]any `db:"filterByJsSetting"` // 字段筛选组件设置参数
FilterOperator string `db:"filterOperator"` // 字段筛选符号
EditableRoles res_type.ResFieldByAnys `db:"editableRoles"` // 字段编辑权限
EditableRoles []string `db:"editableRoles"` // 字段编辑权限
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,13 +1,9 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type DataListImportField struct {
Uuid string `db:"uuid"`
DataListUuid string `db:"data_list_uuid"` // 所属列表 UUID
Title res_type.ResFieldByString `db:"title"` // 列表标题
Title string `db:"title"` // 列表标题
Code string `db:"code"` // 字段名称
CodeResource string `db:"codeResource"` // 字段所属资源
FieldDataType string `db:"fieldDataType"` // 字段数据类型
@ -15,10 +11,10 @@ type DataListImportField struct {
Align string `db:"align"` // 对齐方式
IsWidthFixed bool `db:"isWidthFixed"` // 列宽固定
ConvertByJs string `db:"convertByJs"` // 前端数据转换控件
ConvertByJsSetting res_type.ResFieldByMap `db:"convertByJsSetting"` // 前端数据转换控件设置参数
ConvertByJsSetting map[string]any `db:"convertByJsSetting"` // 前端数据转换控件设置参数
IsVirtual bool `db:"isVirtual"` // 是否虚拟字段
IsValidator int `db:"isValidator"` // 导入字段验证
Validators res_type.ResFieldByMap `db:"validators"` // 导入字段验证规则
Validators map[string]any `db:"validators"` // 导入字段验证规则
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type DataListOperation struct {
Uuid string `db:"uuid"`
Puuid string `db:"pUuid"`
@ -25,12 +21,12 @@ type DataListOperation struct {
PopPlacement string `db:"popPlacement"` // 按钮提示
Widget string `db:"widget"` // 按钮组件
WidgetType string `db:"widgetType"` // 组件类型
WidgetProps res_type.ResFieldByMap `db:"widgetProps"` // 组件PROPS
WidgetSetting res_type.ResFieldByMap `db:"widgetSetting"` // 组件设置
WidgetContainerSetting res_type.ResFieldByMap `db:"widgetContainerSetting"` // 组件容器设置
WidgetProps map[string]any `db:"widgetProps"` // 组件PROPS
WidgetSetting map[string]any `db:"widgetSetting"` // 组件设置
WidgetContainerSetting map[string]any `db:"widgetContainerSetting"` // 组件容器设置
IsRefresh int `db:"isRefresh"` // 0不刷新, 1刷新所有数据, 2刷新一条数据
NoAuthType string `db:"noAuthType"` // 无按钮权限处理方式
Roles res_type.ResFieldByAnys `db:"roles"` // 按钮权限
Roles []string `db:"roles"` // 按钮权限
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,15 +1,11 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type DataListTab struct {
Uuid string `db:"uuid"`
DataListUuid string `db:"data_list_uuid"` // 所属列表 UUID
Label string `db:"label"` // 标签名
Code string `db:"code"` // 标签标识
Order res_type.ResFieldByAnys `db:"order"` // 排序
Order []DataListOrder `db:"order"` // 排序
UseOrderMode int `db:"useOrderMode"` // 排序模式
IsDefault bool `db:"isDefault"` // 是否默认
UpdatedAt string `db:"updated_at"`

View File

@ -1,13 +1,9 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type DataListXlsxField struct {
Uuid string `db:"uuid"`
DataListUuid string `db:"data_list_uuid"` // 所属列表 UUID
Title res_type.ResFieldByString `db:"title"` // 列表标题
Title string `db:"title"` // 列表标题
Code string `db:"code"` // 字段名称
CodeResource string `db:"codeResource"` // 字段所属资源
Alias string `db:"alias"` // 字段别名
@ -15,7 +11,7 @@ type DataListXlsxField struct {
IsExpr bool `db:"isExpr"` // 字段名是否为SQL表达式
IsShow bool `db:"isShow"` // 字段名是否为SQL表达式
ConvertByJs string `db:"convertByJs"` // 字段数据转换组件
ConvertByJsSetting res_type.ResFieldByMap `db:"convertByJsSetting"` // 字段数据转换组件参数
ConvertByJsSetting map[string]any `db:"convertByJsSetting"` // 字段数据转换组件参数
}
type GetDataListXlsxFields func(listUuid string) []DataListXlsxField

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type FsmTransition struct {
Uuid string `db:"uuid"`
FsmUuid string `db:"fsm_uuid"`
@ -15,16 +11,16 @@ type FsmTransition struct {
FsmName string `db:"fsm_name"`
PrimaryKey string `db:"primaryKey"`
StatusField string `db:"statusField"`
StatusOptions res_type.ResFieldByAnys `db:"statusOptions"`
StatusOptions []map[string]string `db:"statusOptions"`
IsPopConfirm bool `db:"isPopConfirm"`
PopTitle string `db:"popTitle"`
PopOkText string `db:"popOkText"`
PopCancelText string `db:"popCancelText"`
PopOkType string `db:"popOkType"`
PopPlacement string `db:"popPlacement"`
WidgetContainerSetting res_type.ResFieldByMap `db:"widgetContainerSetting"`
Roles res_type.ResFieldByAnys `db:"roles"`
OperationRoles res_type.ResFieldByAnys `db:"operationRoles"`
WidgetContainerSetting map[string]any `db:"widgetContainerSetting"`
Roles []string `db:"roles"`
OperationRoles []string `db:"operationRoles"`
IsWithLayoutForm bool `db:"isWithLayoutForm"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type GridLayout struct {
Uuid string `db:"uuid"`
ResourceUuid string `db:"resource_uuid"` // 所属资源UUID
@ -14,9 +10,9 @@ type GridLayout struct {
MarginY int `db:"marginY"` // 栅格 y 间距
Cols int `db:"cols"` // 网格列基数
RowHeight int `db:"rowHeight"` // 栅格行高
Css res_type.ResFieldByMap `db:"css"` // 布局CSS
Props res_type.ResFieldByAnys `db:"props"` // 布局PROPS
Roles res_type.ResFieldByAnys `db:"roles"`
Css map[string]any `db:"css"` // 布局CSS
Props []any `db:"props"` // 布局PROPS
Roles []string `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,7 +1,5 @@
package base
import "git.fsdpf.net/go/contracts/res_type"
type GridLayoutField struct {
Uuid string `db:"uuid"`
GridLayoutUuid string `db:"grid_layout_uuid"` // 所属布局 UUID
@ -18,11 +16,11 @@ type GridLayoutField struct {
Label string `db:"label"`
Widget string `db:"widget"`
WidgetPerfix string `db:"widgetPerfix"`
WidgetDecorator res_type.ResFieldByString `db:"widgetDecorator"`
SubWidgets res_type.ResFieldByAnys `db:"subWidgets"`
WidgetDecorator string `db:"widgetDecorator"`
SubWidgets []map[string]any `db:"subWidgets"`
InitialValue string `db:"initialValue"`
Css res_type.ResFieldByMap `db:"css"`
Extras res_type.ResFieldByMap `db:"extras"`
Css map[string]any `db:"css"`
Extras map[string]any `db:"extras"`
Hidden bool `db:"hidden"`
IsVirtual bool `db:"isVirtual"`
UpdatedAt string `db:"updated_at"`

View File

@ -1,7 +1,5 @@
package base
import "git.fsdpf.net/go/contracts/res_type"
type GridLayoutForm struct {
Uuid string `db:"uuid"`
ResourceUuid string `db:"resource_uuid"` // 所属资源UUID
@ -14,10 +12,10 @@ type GridLayoutForm struct {
RowHeight int `db:"rowHeight"` // 栅格行高
MarginX int `db:"marginX"` // 栅格 x 间距
MarginY int `db:"marginY"` // 栅格 y 间距
FormProps res_type.ResFieldByAnys `db:"formProps"` // 表单PROPS
ListenChangeFields res_type.ResFieldByAnys `db:"listenChangeFields"` // 监听字段
ListenChangeFieldsFunc res_type.ResFieldByString `db:"listenChangeFieldsFunc"` // 监听字段回调方法
Roles res_type.ResFieldByAnys `db:"roles"`
FormProps []map[string]string `db:"formProps"` // 表单PROPS
ListenChangeFields []string `db:"listenChangeFields"` // 监听字段
ListenChangeFieldsFunc string `db:"listenChangeFieldsFunc"` // 监听字段回调方法
Roles []string `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type GridLayoutFormField struct {
Uuid string `db:"uuid"`
GridLayoutFormUuid string `db:"grid_layout_form_uuid"` // 所属布局 UUID
@ -20,14 +16,14 @@ type GridLayoutFormField struct {
Label string `db:"label"`
Widget string `db:"widget"`
WidgetPerfix string `db:"widgetPerfix"`
WidgetDecorator res_type.ResFieldByString `db:"widgetDecorator"`
SubWidgets res_type.ResFieldByAnys `db:"subWidgets"`
WidgetDecorator string `db:"widgetDecorator"`
SubWidgets []any `db:"subWidgets"`
Placeholder string `db:"placeholder"`
Help string `db:"help"`
Disabled int `db:"disabled"`
InitialValue string `db:"initialValue"`
Extras res_type.ResFieldByMap `db:"extras"`
Validators res_type.ResFieldByMap `db:"validators"`
Extras map[string]any `db:"extras"`
Validators map[string]any `db:"validators"`
Hidden bool `db:"hidden"`
IsVirtual bool `db:"isVirtual"`
UpdatedAt string `db:"updated_at"`

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type Layout struct {
Uuid string `db:"uuid"`
ResourceUuid string `db:"resource_uuid"` // 所属资源UUID
@ -16,10 +12,10 @@ type Layout struct {
RowHeight int `db:"rowHeight"` // 栅格行高
MarginX int `db:"marginX"` // 栅格 x 间距
MarginY int `db:"marginY"` // 栅格 y 间距
FormProps res_type.ResFieldByAnys `db:"formProps"` // 表单PROPS
ListenChangeFields res_type.ResFieldByAnys `db:"listenChangeFields"` // 监听字段
ListenChangeFieldsFunc res_type.ResFieldByString `db:"listenChangeFieldsFunc"` // 监听字段回调方法
Roles res_type.ResFieldByAnys `db:"roles"`
FormProps []map[string]string `db:"formProps"` // 表单PROPS
ListenChangeFields []string `db:"listenChangeFields"` // 监听字段
ListenChangeFieldsFunc string `db:"listenChangeFieldsFunc"` // 监听字段回调方法
Roles []string `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type LayoutField struct {
Uuid string `db:"uuid"`
LayoutUuid string `db:"layout_uuid"` // 所属布局 UUID
@ -20,14 +16,14 @@ type LayoutField struct {
Label string `db:"label"`
Widget string `db:"widget"`
WidgetPerfix string `db:"widgetPerfix"`
WidgetDecorator res_type.ResFieldByString `db:"widgetDecorator"`
SubWidgets res_type.ResFieldByAnys `db:"subWidgets"`
WidgetDecorator string `db:"widgetDecorator"`
SubWidgets []map[string]any `db:"subWidgets"`
Placeholder string `db:"placeholder"`
Help string `db:"help"`
Disabled int `db:"disabled"`
InitialValue string `db:"initialValue"`
Extras res_type.ResFieldByMap `db:"extras"`
Validators res_type.ResFieldByMap `db:"validators"`
Extras map[string]any `db:"extras"`
Validators map[string]any `db:"validators"`
Hidden bool `db:"hidden"`
IsVirtual bool `db:"isVirtual"`
UpdatedAt string `db:"updated_at"`

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type Menu struct {
Uuid string `db:"uuid"`
Id int `db:"id"`
@ -13,10 +9,10 @@ type Menu struct {
Icon string `db:"icon"`
Widget string `db:"widget"`
WidgetType string `db:"widgetType"`
WidgetProps res_type.ResFieldByMap `db:"widgetProps"`
WidgetSetting res_type.ResFieldByMap `db:"widgetSetting"`
WidgetContainerSetting res_type.ResFieldByMap `db:"widgetContainerSetting"`
Roles res_type.ResFieldByAnys `db:"roles"`
WidgetProps map[string]any `db:"widgetProps"`
WidgetSetting map[string]any `db:"widgetSetting"`
WidgetContainerSetting map[string]any `db:"widgetContainerSetting"`
Roles []string `db:"roles"`
Platform string `db:"platform"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`

View File

@ -1,17 +1,13 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type PrintTemplate struct {
Uuid string `db:"uuid"`
ResourceUuid string `db:"resource_uuid"` // 所属资源UUID
Code string `db:"code"` // 打印模板标识
Name string `db:"name"` // 打印模板名称
PrimaryKey string `db:"primaryKey"` // 主键标识
Roles res_type.ResFieldByAnys `db:"roles"` // 打印权限
Template res_type.ResFieldByMap `db:"template"` // 打印权限
Roles []string `db:"roles"` // 打印权限
Template map[string]any `db:"template"` // 打印权限
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,13 +1,9 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type PrintTemplateField struct {
Uuid string `db:"uuid"`
PrintTemplateUuid string `db:"print_template_uuid"` // 所属打印模板UUID
Label res_type.ResFieldByString `db:"label"` // 字段标签
Label string `db:"label"` // 字段标签
Code string `db:"code"` // 字段名称
CodeResource string `db:"codeResource"` // 字段所属资源
Category string `db:"category"` // 字段控件类型
@ -15,7 +11,7 @@ type PrintTemplateField struct {
IsExpr bool `db:"isExpr"` // 字段名是否为SQL表达式
FieldDataType string `db:"fieldDataType"` // 字段数据类型
WidgetByJs string `db:"widgetByJs"` // 前端数据渲染控件
WidgetByJsSetting res_type.ResFieldByMap `db:"widgetByJsSetting"` // 前端数据渲染控件设置参数
WidgetByJsSetting map[string]any `db:"widgetByJsSetting"` // 前端数据渲染控件设置参数
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -102,7 +102,7 @@ func (this *QueryField) ToStructField(tags ...string) reflect.StructField {
switch this.typ {
case contracts.QueryDataType_String:
typ = reflect.TypeOf(res_type.ResFieldByString(""))
typ = reflect.TypeOf(string(""))
case contracts.QueryDataType_Number:
typ = reflect.TypeOf(res_type.ResFieldByNumber(0))
case contracts.QueryDataType_Integer:
@ -114,7 +114,7 @@ func (this *QueryField) ToStructField(tags ...string) reflect.StructField {
case contracts.QueryDataType_Array:
typ = reflect.TypeOf(res_type.ResFieldByAnys{})
case contracts.QueryDataType_Json:
typ = reflect.TypeOf(res_type.ResFieldByMap{})
typ = reflect.TypeOf(map[string]any{})
}
return reflect.StructField{

View File

@ -1,8 +1,12 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type ResApiParam struct {
Code string `db:"code"`
Name string `db:"name"`
Category string `db:"category"`
DataType string `db:"type"`
isRequired bool `db:"isRequired"`
}
type ResApi struct {
Uuid string `db:"uuid"`
@ -13,8 +17,8 @@ type ResApi struct {
ResourceUuid string `db:"resource_uuid"`
Method string `db:"method"`
Category string `db:"action"`
Params res_type.ResFieldByAnys `db:"params"`
Roles res_type.ResFieldByAnys `db:"roles"`
Params []ResApiParam `db:"params"`
Roles []string `db:"roles"`
IsAuthDB int `db:"is_auth_db"` // 启用权限过滤
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`

View File

@ -1,8 +1,15 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type ResApiApprovalFlow struct {
Uuid string `json:"uuid"`
Code string `json:"code"`
Name string `json:"name"`
RoleUuid string `json:"role_uuid"`
Type int64 `json:"type"`
Yes string `json:"yes"`
No string `json:"no"`
Comment string `json:"comment"`
}
type ResApiApproval struct {
Uuid string `db:"uuid"`
@ -10,9 +17,9 @@ type ResApiApproval struct {
Code string `db:"code"`
Name string `db:"name"`
MarkField string `db:"markField"`
RolesUuid res_type.ResFieldByAnys `db:"rolesUuid"`
Flows res_type.ResFieldByAnys `db:"flows"`
Roles res_type.ResFieldByAnys `db:"roles"`
RolesUuid []string `db:"rolesUuid"`
Flows []ResApiApprovalFlow `db:"flows"`
Roles []string `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -40,7 +40,7 @@ func (this ResField) ToStructField(tags ...string) reflect.StructField {
switch this.DataType {
case contracts.ResDataType_String, contracts.ResDataType_Text, contracts.ResDataType_Enum,
contracts.ResDataType_Timestamp, contracts.ResDataType_Date, contracts.ResDataType_Datetime:
typ = reflect.TypeOf(res_type.ResFieldByString(""))
typ = reflect.TypeOf(string(""))
case contracts.ResDataType_Integer, contracts.ResDataType_SmallInteger:
typ = reflect.TypeOf(res_type.ResFieldByInteger(0))
case contracts.ResDataType_Decimal:
@ -51,7 +51,7 @@ func (this ResField) ToStructField(tags ...string) reflect.StructField {
if this.Default != "" && this.Default[0:1] == "[" {
typ = reflect.TypeOf(res_type.ResFieldByAnys{})
} else {
typ = reflect.TypeOf(res_type.ResFieldByMap{})
typ = reflect.TypeOf(map[string]any{})
}
}
@ -109,7 +109,7 @@ func (this ResField) ToValue(v any) any {
v = float64(data)
case res_type.ResFieldByNumber:
v = float64(data)
case res_type.ResFieldByString:
case string:
v = strings.Trim(string(data), " ")
case res_type.ResFieldByAnys:
if v != nil {
@ -117,12 +117,6 @@ func (this ResField) ToValue(v any) any {
return string(b)
}
v = []any(data)
case res_type.ResFieldByMap:
if v != nil {
b, _ := json.Marshal(v)
return string(b)
}
v = map[string]any(data)
case []any, []string, []int, []float64, []float32, []int64:
if v != nil {
b, _ := json.Marshal(v)

View File

@ -1,17 +1,13 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type ResWidgetOperation struct {
Uuid string `db:"uuid"`
WidgetUuid string `db:"widget_uuid"`
Name string `db:"name"`
NoAuthType string `db:"noAuthType"`
PropsAuthRule res_type.ResFieldByAnys `db:"propsAuthRule"`
ExtraAuthRule res_type.ResFieldByAnys `db:"extraAuthRule"`
Roles res_type.ResFieldByAnys `db:"roles"`
PropsAuthRule []any `db:"propsAuthRule"`
ExtraAuthRule []any `db:"extraAuthRule"`
Roles []string `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -12,7 +12,6 @@ import (
"git.fsdpf.net/go/contracts"
"git.fsdpf.net/go/contracts/helper"
"git.fsdpf.net/go/contracts/res_type"
"git.fsdpf.net/go/contracts/support"
"git.fsdpf.net/go/db"
)
@ -54,7 +53,7 @@ type Resource struct {
IsHistoryRecord bool `db:"isHistoryRecord"`
HistoryCacheMax int `db:"historyCacheMax"`
Fields ResFields `db:"fields"`
Roles res_type.ResFieldByMap `db:"roles"`
Roles map[string]any `db:"roles"`
UpdatedAt string `db:"updated_at"`
CreatedAt string `db:"created_at"`
}

View File

@ -1,9 +1,5 @@
package base
import (
"git.fsdpf.net/go/contracts/res_type"
)
type Route struct {
Uuid string `db:"uuid"`
Name string `db:"name"`
@ -13,9 +9,9 @@ type Route struct {
IsPhone bool `db:"isPhone"`
Type string `db:"type"`
Component string `db:"component"`
WidgetProps res_type.ResFieldByMap `db:"widgetProps"`
WidgetSetting res_type.ResFieldByMap `db:"widgetSetting"`
WidgetContainerSetting res_type.ResFieldByMap `db:"widgetContainerSetting"`
WidgetProps map[string]any `db:"widgetProps"`
WidgetSetting map[string]any `db:"widgetSetting"`
WidgetContainerSetting map[string]any `db:"widgetContainerSetting"`
Exact bool `db:"exact"`
Platform string `db:"platform"`
UpdatedAt string `db:"updated_at"`

2
go.mod
View File

@ -3,7 +3,7 @@ module git.fsdpf.net/go/contracts
go 1.18
require (
git.fsdpf.net/go/db v0.0.0-20230412075825-59b3faa171bc
git.fsdpf.net/go/db v0.0.0-20230621051209-5740d112407f
github.com/go-chi/chi v1.5.4
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0

6
go.sum
View File

@ -38,6 +38,12 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.fsdpf.net/go/db v0.0.0-20230412075825-59b3faa171bc h1:d3ZqjNGbsgVknkbvATV96rv1bW8mwqbmnV5bfGTVRVU=
git.fsdpf.net/go/db v0.0.0-20230412075825-59b3faa171bc/go.mod h1:397Sdx1cJS0OlHtTX1bVl//9k3Xn0Klnc6jC4MAkb6w=
git.fsdpf.net/go/db v0.0.0-20230621020351-bf3032103e5f h1:h8Id5NLdX4zaAVd+Qe1iO5M3O4LTtTkHQCHBKAjt1Tc=
git.fsdpf.net/go/db v0.0.0-20230621020351-bf3032103e5f/go.mod h1:397Sdx1cJS0OlHtTX1bVl//9k3Xn0Klnc6jC4MAkb6w=
git.fsdpf.net/go/db v0.0.0-20230621030725-28d9dcbd4dcb h1:3igohcxzv3K+uir9IGBK1AGV8OC7FvfW6fyFD98QqcM=
git.fsdpf.net/go/db v0.0.0-20230621030725-28d9dcbd4dcb/go.mod h1:397Sdx1cJS0OlHtTX1bVl//9k3Xn0Klnc6jC4MAkb6w=
git.fsdpf.net/go/db v0.0.0-20230621051209-5740d112407f h1:H+/H6j+hyFMgSy+tUNmymRy7/PWQRjjp8qY/DrhwrsY=
git.fsdpf.net/go/db v0.0.0-20230621051209-5740d112407f/go.mod h1:397Sdx1cJS0OlHtTX1bVl//9k3Xn0Klnc6jC4MAkb6w=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=