gorm wire
This commit is contained in:
@@ -2,7 +2,7 @@ package sliceutil
|
||||
|
||||
import "sort"
|
||||
|
||||
// 使用 map 去除重复元素
|
||||
// RemoveDuplicatesWithMap 使用 map 去除重复元素
|
||||
func RemoveDuplicatesWithMap[T comparable](slice []T) []T {
|
||||
result := make([]T, 0, len(slice))
|
||||
seen := make(map[T]bool)
|
||||
@@ -15,7 +15,7 @@ func RemoveDuplicatesWithMap[T comparable](slice []T) []T {
|
||||
return result
|
||||
}
|
||||
|
||||
// 先排序再去重
|
||||
// RemoveDuplicatesWithSort 先排序再去重
|
||||
func RemoveDuplicatesWithSort(slice []int) []int {
|
||||
if len(slice) == 0 {
|
||||
return slice
|
||||
|
||||
Reference in New Issue
Block a user