1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

make SortByField function deprecate

This commit is contained in:
dudaodong
2022-12-02 15:17:08 +08:00
parent 280ecb5cef
commit 82c8a04c35

View File

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