Go 整形转成int64

func ParseInt(num interface{}) (int64, bool) {
	switch num.(type) {
	case int64:
		return num.(int64), true

	case int32:
		return int64(num.(int32)), true
	case int16:
		return int64(num.(int16)), true
	case int8:
		return int64(num.(int8)), true
	case int:
		return int64(num.(int)), true
	}
	return 0, false
}

你可能感兴趣的:(Go,golang,开发语言,后端)