clean code
This commit is contained in:
parent
7524ba931f
commit
4474e9151c
34
array.go
34
array.go
@ -36,8 +36,8 @@ type ArrayType struct {
|
||||
value interface{}
|
||||
convertResult []interface{}
|
||||
convertErr error
|
||||
isSimpleSlice bool
|
||||
itemType reflect.Kind
|
||||
isSimpleSlice bool // 是否简单list, 即数据的每一项类型相同, 且都是基础内置数据类型
|
||||
itemType reflect.Kind // 简单list场景下, 每一项的数据类型
|
||||
}
|
||||
|
||||
// IsNil 输入是否为nil
|
||||
@ -205,40 +205,12 @@ func (at *ArrayType) Convert() {
|
||||
}
|
||||
}
|
||||
|
||||
// IsSimpleSlice 是否简单list, 即数据的每一项类型相同, 且都是基础内置数据类型
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:50 2023/6/12
|
||||
func (at *ArrayType) IsSimpleSlice() bool {
|
||||
if at.ItemIsInterface() {
|
||||
// 每一项都是interface
|
||||
return false
|
||||
}
|
||||
switch at.value.(type) {
|
||||
case []int8:
|
||||
case []int16:
|
||||
case []int32:
|
||||
case []int64:
|
||||
case []int:
|
||||
case []uint:
|
||||
case []uint8:
|
||||
case []uint16:
|
||||
case []uint32:
|
||||
case []uint64:
|
||||
case []float32:
|
||||
case []float64:
|
||||
case []bool:
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Unique 对数据结果进行去重
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 17:43 2023/6/12
|
||||
func (at *ArrayType) Unique() []interface{} {
|
||||
|
||||
return []interface{}{}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user