array 增加 to string slice

This commit is contained in:
白茶清欢 2024-04-22 11:44:17 +08:00
parent ee726ea6bc
commit 8c922be06d
1 changed files with 14 additions and 0 deletions

View File

@ -231,6 +231,20 @@ func (at *Array) ConvertIgnoreError() []interface{} {
return res
}
// ToStringSlice ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 11:42 2024/4/22
func (at *Array) ToStringSlice() []string {
res := at.ConvertIgnoreError()
list := make([]string, 0)
for _, item := range res {
list = append(list, fmt.Sprintf("%v", item))
}
return list
}
// Unique 对数据结果进行去重
//
// Author : go_developer@163.com<白茶清欢>