bbgo_origin/pkg/dynamic/can.go

15 lines
291 B
Go
Raw Permalink Normal View History

2022-08-18 09:05:52 +00:00
package dynamic
import "reflect"
// For backward compatibility of reflect.Value.CanInt in go1.17
func CanInt(v reflect.Value) bool {
k := v.Type().Kind()
switch k {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return true
default:
return false
}
}