优化提取字段返回值
This commit is contained in:
parent
f3f064d064
commit
e3de2835a9
6
array.go
6
array.go
@ -149,9 +149,9 @@ func (at *Array[Bt]) ToStringWithSplit(split string) StringResult {
|
|||||||
// Author : go_developer@163.com<白茶清欢>
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
//
|
//
|
||||||
// Date : 19:00 2024/10/13
|
// Date : 19:00 2024/10/13
|
||||||
func (at *Array[Bt]) ExtraField(fieldName string) *Array[any] {
|
func (at *Array[Bt]) ExtraField(fieldName string) String {
|
||||||
if at.IsNil() {
|
if at.IsNil() {
|
||||||
return ArrayType[any]([]any{})
|
return String("[]")
|
||||||
}
|
}
|
||||||
byteData, _ := json.Marshal(at.value)
|
byteData, _ := json.Marshal(at.value)
|
||||||
res := make([]any, 0)
|
res := make([]any, 0)
|
||||||
@ -162,5 +162,5 @@ func (at *Array[Bt]) ExtraField(fieldName string) *Array[any] {
|
|||||||
res = append(res, itemValue.Value())
|
res = append(res, itemValue.Value())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ArrayType(res)
|
return String(ArrayType(res).ToString().Value)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user