From 82c8a04c356922a191bdb4a251131ee8e470d555 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Fri, 2 Dec 2022 15:17:08 +0800 Subject: [PATCH] make SortByField function deprecate --- slice/slice.go | 1 + 1 file changed, 1 insertion(+) diff --git a/slice/slice.go b/slice/slice.go index 307ef34..f588752 100644 --- a/slice/slice.go +++ b/slice/slice.go @@ -734,6 +734,7 @@ func SortBy[T any](slice []T, less func(a, b T) bool) { // SortByField return sorted slice by field // slice element should be struct, field type should be int, uint, string, or bool // default sortType is ascending (asc), if descending order, set sortType to desc +// This function is deprecated, use Sort and SortBy for replacement func SortByField(slice any, field string, sortType ...string) error { sv := sliceValue(slice) t := sv.Type().Elem()