mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
1
This commit is contained in:
parent
2b1868f558
commit
4649ce5354
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module Open_IM
|
||||
|
||||
go 1.15
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
firebase.google.com/go v3.13.0+incompatible
|
||||
|
@ -122,6 +122,18 @@ func RemoveDuplicateElement(idList []string) []string {
|
||||
return result
|
||||
}
|
||||
|
||||
func RemoveDuplicate[T comparable](arr []T) []T {
|
||||
result := make([]T, 0, len(arr))
|
||||
temp := map[T]struct{}{}
|
||||
for _, item := range arr {
|
||||
if _, ok := temp[item]; !ok {
|
||||
temp[item] = struct{}{}
|
||||
result = append(result, item)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func IsDuplicateStringSlice(arr []string) bool {
|
||||
t := make(map[string]struct{})
|
||||
for _, s := range arr {
|
||||
|
Loading…
x
Reference in New Issue
Block a user