优化数据类型定义
This commit is contained in:
parent
44de8814d8
commit
fcf1a7fbd4
14
define.go
14
define.go
@ -7,7 +7,9 @@
|
||||
// Date : 2022-07-04 18:02
|
||||
package filter
|
||||
|
||||
import "git.zhangdeman.cn/zhangdeman/consts/enums"
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
)
|
||||
|
||||
// MapRule 映射规则
|
||||
//
|
||||
@ -15,9 +17,9 @@ import "git.zhangdeman.cn/zhangdeman/consts/enums"
|
||||
//
|
||||
// Date : 12:21 2022/7/4
|
||||
type MapRule struct {
|
||||
SourcePath string `json:"source_path"` // 原路径
|
||||
TargetPath string `json:"target_path"` // 目标路径路径
|
||||
Required bool `json:"required"` // 必须存在
|
||||
DataType enums.DataType `json:"data_type"` // 数据类型
|
||||
DefaultValue string `json:"default_value"` // 默认值, 以字符串传入, 会转换成 DataType
|
||||
SourcePath string `json:"source_path"` // 原路径
|
||||
TargetPath string `json:"target_path"` // 目标路径路径
|
||||
Required bool `json:"required"` // 必须存在
|
||||
DataType consts.DataType `json:"data_type"` // 数据类型
|
||||
DefaultValue string `json:"default_value"` // 默认值, 以字符串传入, 会转换成 DataType
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/consts/enums"
|
||||
"git.zhangdeman.cn/zhangdeman/serialize"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
"reflect"
|
||||
@ -197,7 +196,7 @@ func (f *filter) Parse(receiver interface{}) error {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:25 2022/7/4
|
||||
func (f *filter) getValue(dataType enums.DataType, sourceValue gjson.Result, defaultValue string) (any, error) {
|
||||
func (f *filter) getValue(dataType consts.DataType, sourceValue gjson.Result, defaultValue string) (any, error) {
|
||||
sourceValueStr := defaultValue
|
||||
if sourceValue.Exists() {
|
||||
str := sourceValue.String()
|
||||
|
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.21
|
||||
toolchain go1.21.5
|
||||
|
||||
require (
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241125061350-1f5050978fc3
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241125065114-f919222003d9
|
||||
git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda
|
||||
git.zhangdeman.cn/zhangdeman/serialize v0.0.0-20241108082010-42ae8fe5ebdc
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20240618042405-6ee2c904644e
|
||||
|
2
go.sum
2
go.sum
@ -4,6 +4,8 @@ git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241104082108-0f97a870bbc3 h1:BiAlBJ
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241104082108-0f97a870bbc3/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241125061350-1f5050978fc3 h1:/40XIygeSxRhPQc3/7pKGpV5hg8jwrMwh1+YiyCHdNI=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241125061350-1f5050978fc3/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241125065114-f919222003d9 h1:TP/M3WnGsxh0Vr6YuS1i28hw1oV//YbdCoI46PUBIA0=
|
||||
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20241125065114-f919222003d9/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
|
||||
git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda h1:bMD6r9gjRy7cO+T4zRQVYAesgIblBdTnhzT1vN5wjvI=
|
||||
git.zhangdeman.cn/zhangdeman/easylock v0.0.0-20230731062340-983985c12eda/go.mod h1:dT0rmHcJ9Z9IqWeMIt7YzR88nKkNV2V3dfG0j9Q6lK0=
|
||||
git.zhangdeman.cn/zhangdeman/easymap v0.0.0-20240311030808-e2a2e6a3c211 h1:I/wOsRpCSRkU9vo1u703slQsmK0wnNeZzsWQOGtIAG0=
|
||||
|
Loading…
Reference in New Issue
Block a user