gorm wire

This commit is contained in:
2025-05-07 14:12:53 +08:00
parent 461531c308
commit 68606c76f9
111 changed files with 1726 additions and 5809 deletions

View File

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