rpc GroupApplicationResponse

This commit is contained in:
withchao
2023-02-06 15:32:20 +08:00
parent 49983b8c83
commit 210d04d488
7 changed files with 97 additions and 71 deletions
+5 -5
View File
@@ -67,7 +67,7 @@ func DeleteAt[E any](es *[]E, index ...int) []E {
}
// IndexAny get the index of the element
func IndexAny[E any, K comparable](es []E, e E, fn func(e E) K) int {
func IndexAny[E any, K comparable](e E, es []E, fn func(e E) K) int {
k := fn(e)
for i := 0; i < len(es); i++ {
if fn(es[i]) == k {
@@ -78,15 +78,15 @@ func IndexAny[E any, K comparable](es []E, e E, fn func(e E) K) int {
}
// IndexOf get the index of the element
func IndexOf[E comparable](es []E, e E) int {
return IndexAny(es, e, func(t E) E {
func IndexOf[E comparable](e E, es ...E) int {
return IndexAny(e, es, func(t E) E {
return t
})
}
// Contain 是否包含
func Contain[E comparable](es []E, e E) bool {
return IndexOf(es, e) >= 0
func Contain[E comparable](e E, es ...E) bool {
return IndexOf(e, es...) >= 0
}
// DuplicateAny 是否有重复的