增加数据类型描述
This commit is contained in:
		
							
								
								
									
										79
									
								
								data_type.go
									
									
									
									
									
								
							
							
						
						
									
										79
									
								
								data_type.go
									
									
									
									
									
								
							@ -50,7 +50,7 @@ const (
 | 
			
		||||
	DataTypeMapStrAny                    = "map[string]any"            // map -> map[string]any
 | 
			
		||||
	DataTypeMapStrAnyWithMarshal         = "map[string]any_marshal"    // map -> map[string]any, json序列化之后的结果
 | 
			
		||||
	DataTypeMapStrStr                    = "map[string]string"         // map -> map[string]string
 | 
			
		||||
	DataTypeMapStrStrWithMarshal         = "map[string]string_marshal" // map -> map[string]string, json薛烈换之后的结果
 | 
			
		||||
	DataTypeMapStrStrWithMarshal         = "map[string]string_marshal" // map -> map[string]string, json序列化之后的结果
 | 
			
		||||
	DataTypeMapAnyAny                    = "map[any]any"               // map -> map[any]any
 | 
			
		||||
	DataTypeMapAnyAnyWithMarshal         = "map[any]any_marshal"       // map -> map[any]any, json序列化之后的结果
 | 
			
		||||
	DataTypeMapStrSlice                  = "map[string][]any"          // map -> map[string][]any
 | 
			
		||||
@ -76,3 +76,80 @@ const (
 | 
			
		||||
	DataMapModelReal    = "REAL"
 | 
			
		||||
	DataMapModelMarshal = "MARSHAL"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// DataTypeDesc 数据类型描述
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 13:22 2024/6/23
 | 
			
		||||
type DataTypeDesc struct {
 | 
			
		||||
	Value       string `json:"value"`       // 具体数据类型
 | 
			
		||||
	Description string `json:"description"` // 数据类型描述
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	DataTypeList = []DataTypeDesc{
 | 
			
		||||
		// 基础数据类型
 | 
			
		||||
		getDataTypeDesc(DataTypeAny, "任意数据类型"),
 | 
			
		||||
		getDataTypeDesc(DataTypeInt, "int类型 -> int64"),
 | 
			
		||||
		getDataTypeDesc(DataTypeUint, "uint类型 -> uint64"),
 | 
			
		||||
		getDataTypeDesc(DataTypeFloat, "float类型 -> float64"),
 | 
			
		||||
		getDataTypeDesc(DataTypeBool, "bool类型"),
 | 
			
		||||
		getDataTypeDesc(DataTypeString, "字符串类型"),
 | 
			
		||||
 | 
			
		||||
		// map数据类型
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrAny, "map[string]any"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrAnyWithMarshal, "map[string]any json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrInt, "map[string]int64"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrIntWithMarshal, "map[string]int64 json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrUint, "map[string]uint64"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrUintWithMarshal, "map[string]uint64 json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrFloat, "map[string]float64"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrFloatWithMarshal, "map[string]float64 json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrBool, "map[string]bool"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrBoolWithMarshal, "map[string]bool json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrStr, "map[string]string"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrStrWithMarshal, "map[string]string json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapAnyAny, "map[any]any"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapAnyAnyWithMarshal, "map[any]any json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrSlice, "map[string][]any"),
 | 
			
		||||
		getDataTypeDesc(DataTypeMapStrSliceWithMarshal, "map[string][]any json序列化之后的结果"),
 | 
			
		||||
 | 
			
		||||
		// slice数据类型
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceAny, "[]any"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceString, "[]string"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceStringWithChar, "[]string 按照指定字符切割"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceStringWithMarshal, "[]string json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceAnyWithMarshal, "[]any json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceInt, "[]int"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceIntWithChar, "[]int 按照指定字符切割"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceIntWithMarshal, "[]int json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceUint, "[]uint"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceUintWithChar, "[]uint 按照指定字符切割"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceUintWithMarshal, "[]uint json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceFloat, "[]float"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceFloatWithChar, "[]float 按照指定字符切割"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceFloatWithMarshal, "[]float json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceBool, "[]bool"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceBoolWithChar, "[]bool 按照指定字符切割"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceBoolWithMarshal, "[]bool json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceSlice, "[][]any"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceSliceWithMarshal, "[][]any json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceMapStringAny, "[][]map[string]any"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceMapStringAnyWithMarshal, "[][]map[string]any json序列化之后的结果"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceMapAnyAny, "[]map[any]any"),
 | 
			
		||||
		getDataTypeDesc(DataTypeSliceMapAnyAnyWithMarshal, "[]map[any]any json序列化之后的结果"),
 | 
			
		||||
	}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// getDataTypeDesc ...
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 13:24 2024/6/23
 | 
			
		||||
func getDataTypeDesc(value string, description string) DataTypeDesc {
 | 
			
		||||
	return DataTypeDesc{
 | 
			
		||||
		Value:       value,
 | 
			
		||||
		Description: description,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user