mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-08 19:45:22 +08:00
1
This commit is contained in:
parent
eb3bb7948f
commit
26b5ed72df
@ -1,5 +1,7 @@
|
|||||||
package utilsv2
|
package utilsv2
|
||||||
|
|
||||||
|
import "Open_IM/pkg/common/db/table"
|
||||||
|
|
||||||
//func DuplicateRemoval[T comparable](ts []T) []T {
|
//func DuplicateRemoval[T comparable](ts []T) []T {
|
||||||
// v := make([]T, 0, len(ts))
|
// v := make([]T, 0, len(ts))
|
||||||
// tmp := map[T]struct{}{}
|
// tmp := map[T]struct{}{}
|
||||||
@ -31,8 +33,17 @@ func DuplicateRemoval[T comparable](ts []T) []T {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func demo() {
|
||||||
|
|
||||||
|
groups := []*table.GroupModel{}
|
||||||
|
|
||||||
|
groups = DuplicateRemovalAny(groups, func(t *table.GroupModel) string {
|
||||||
|
return t.GroupID
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func DeleteAt[T any](ts []T, index ...int) []T {
|
func DeleteAt[T any](ts []T, index ...int) []T {
|
||||||
l := len(ts)
|
|
||||||
switch len(index) {
|
switch len(index) {
|
||||||
case 0:
|
case 0:
|
||||||
return ts
|
return ts
|
||||||
@ -43,7 +54,6 @@ func DeleteAt[T any](ts []T, index ...int) []T {
|
|||||||
for _, v := range index {
|
for _, v := range index {
|
||||||
tmp[v] = struct{}{}
|
tmp[v] = struct{}{}
|
||||||
}
|
}
|
||||||
v := make([]byte)
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user