16 lines
294 B
Go
16 lines
294 B
Go
package util
|
||
|
||
import (
|
||
"errors"
|
||
)
|
||
|
||
// 判断obj是否在target中,target支持的类型arrary,slice
|
||
func ContainForInt64Arry(obj int64, target []int64) (bool, error) {
|
||
for _, value := range target {
|
||
if value == obj {
|
||
return true, nil
|
||
}
|
||
}
|
||
return false, errors.New("not in array")
|
||
}
|