优化提取字段返回值

This commit is contained in:
白茶清欢 2024-10-13 19:28:16 +08:00
parent f3f064d064
commit e3de2835a9

View File

@ -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)
} }