mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Update index when updating resources.
This commit is contained in:
13
server/utils/slice.go
Normal file
13
server/utils/slice.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package utils
|
||||
|
||||
func RemoveDuplicate[T comparable](slice []T) []T {
|
||||
seen := make(map[T]struct{})
|
||||
var result []T
|
||||
for _, v := range slice {
|
||||
if _, ok := seen[v]; !ok {
|
||||
seen[v] = struct{}{}
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
Reference in New Issue
Block a user