mirror of
https://github.com/duke-git/lancet.git
synced 2026-03-01 00:35:28 +08:00
make SortByField function deprecate
This commit is contained in:
@@ -734,6 +734,7 @@ func SortBy[T any](slice []T, less func(a, b T) bool) {
|
|||||||
// SortByField return sorted slice by field
|
// SortByField return sorted slice by field
|
||||||
// slice element should be struct, field type should be int, uint, string, or bool
|
// 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
|
// 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 {
|
func SortByField(slice any, field string, sortType ...string) error {
|
||||||
sv := sliceValue(slice)
|
sv := sliceValue(slice)
|
||||||
t := sv.Type().Elem()
|
t := sv.Type().Elem()
|
||||||
|
|||||||
Reference in New Issue
Block a user