MCPcopy
hub / github.com/AlistGo/alist / MustSliceConvert

Function MustSliceConvert

pkg/utils/slice.go:59–66  ·  view source on GitHub ↗
(srcS []S, convert func(src S) D)

Source from the content-addressed store, hash-verified

57}
58
59func MustSliceConvert[S any, D any](srcS []S, convert func(src S) D) []D {
60 res := make([]D, 0, len(srcS))
61 for i := range srcS {
62 dst := convert(srcS[i])
63 res = append(res, dst)
64 }
65 return res
66}
67
68func MergeErrors(errs ...error) error {
69 errStr := strings.Join(MustSliceConvert(errs, func(err error) string {

Callers 13

GetAllFilesMethod · 0.92
fsidsFormatNotUkFunction · 0.92
ListMethod · 0.92
ListMethod · 0.92
ListMethod · 0.92
ObjectsMethod · 0.92
ObjectsMethod · 0.92
BuildIndexFunction · 0.92
GetSettingItemsInGroupsFunction · 0.92
SearchFunction · 0.92
getTaskInfosFunction · 0.92

Calls 1

convertFunction · 0.85

Tested by

no test coverage detected