mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 12:59:23 +08:00
cd52adc18b
Signed-off-by: dragondriver <jiquan.long@zilliz.com>
22 lines
362 B
Go
22 lines
362 B
Go
package proxyservice
|
|
|
|
import (
|
|
"reflect"
|
|
)
|
|
|
|
// what if golang support generic programming
|
|
func SliceContain(s interface{}, item interface{}) bool {
|
|
ss := reflect.ValueOf(s)
|
|
if ss.Kind() != reflect.Slice {
|
|
panic("SliceContain expect a slice")
|
|
}
|
|
|
|
for i := 0; i < ss.Len(); i++ {
|
|
if ss.Index(i).Interface() == item {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|