Documentation ¶
Index ¶
- Variables
- func CheckOverflowFloat(x float64, k reflect.Kind) bool
- func CheckOverflowInt(x int64, k reflect.Kind) bool
- func CheckOverflowUInt(x uint64, k reflect.Kind) bool
- func ConvertFloatToFloat64(num interface{}) (float64, bool)
- func ConvertSignedIntToInt64(num interface{}) (int64, bool)
- func ConvertToReflectType(v Value, toType reflect.Kind) (value reflect.Value, ok bool)
- func ConvertUnsignedIntToUInt64(num interface{}) (uint64, bool)
- func Equal(expect, real interface{}) bool
- func FloatEqual(a, b float64) bool
- func FloatEqualC(a, b, eps float64) bool
- func FloatIsInt(f float64) bool
- func FloatIsInt64(f float64) bool
- func FloatIsIntC(f, eps float64) bool
- func FloatIsUInt64(f float64) bool
- func FloatToInt64(f float64) int64
- func FloatToUInt64(f float64) uint64
- func ParseBool(b interface{}) (v bool, ok bool)
- func ParseBoolFromNumber(number *GenericNumber) bool
- func ParseBoolFromString(b string) (v bool, ok bool)
- func ToString(v interface{}) string
- type GenericNumber
- func BigFloatFromString(num string) (*GenericNumber, bool)
- func BigIntFromString(num string) (*GenericNumber, bool)
- func FloatFromString(num string) (*GenericNumber, bool)
- func IntFromString(num string) (*GenericNumber, bool)
- func NumberFromBasicFloat(num interface{}) (*GenericNumber, bool)
- func NumberFromBasicInt(num interface{}) (*GenericNumber, bool)
- func NumberFromBasicIntType(num interface{}) (*GenericNumber, bool)
- func NumberFromBasicType(num interface{}) (*GenericNumber, bool)
- func NumberFromBasicUInt(num interface{}) (*GenericNumber, bool)
- func NumberFromString(num string) (*GenericNumber, bool)
- func ParseNumber(num interface{}) (*GenericNumber, bool)
- func UIntFromString(num string) (*GenericNumber, bool)
- func (num *GenericNumber) Above64bit() bool
- func (num *GenericNumber) Float() bool
- func (num *GenericNumber) Float64() float64
- func (num *GenericNumber) Int64() int64
- func (num *GenericNumber) IsFloat64() bool
- func (num *GenericNumber) IsInt64() bool
- func (num *GenericNumber) IsUInt64() bool
- func (num *GenericNumber) String() string
- func (num *GenericNumber) UInt64() uint64
- func (num *GenericNumber) Unsigned() bool
- type Number
- type String
- type Stringer
- type Type
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidType = fmt.Errorf("invalid type")
View Source
var ErrTooLarge = fmt.Errorf("value too large")
View Source
var FloatEps = 1e-8 //容忍度
Functions ¶
func ConvertFloatToFloat64 ¶
func ConvertSignedIntToInt64 ¶
func ConvertToReflectType ¶
func FloatEqual ¶
func FloatEqualC ¶
func FloatIsInt ¶
func FloatIsInt64 ¶
func FloatIsIntC ¶
func FloatIsUInt64 ¶
func FloatToInt64 ¶
func FloatToUInt64 ¶
func ParseBoolFromNumber ¶
func ParseBoolFromNumber(number *GenericNumber) bool
0 = false other = true
func ParseBoolFromString ¶
Types ¶
type GenericNumber ¶
type GenericNumber struct {
// contains filtered or unexported fields
}
func BigFloatFromString ¶
func BigFloatFromString(num string) (*GenericNumber, bool)
func BigIntFromString ¶
func BigIntFromString(num string) (*GenericNumber, bool)
func FloatFromString ¶
func FloatFromString(num string) (*GenericNumber, bool)
func NumberFromBasicFloat ¶
func NumberFromBasicFloat(num interface{}) (*GenericNumber, bool)
func NumberFromBasicInt ¶
func NumberFromBasicInt(num interface{}) (*GenericNumber, bool)
func NumberFromBasicIntType ¶
func NumberFromBasicIntType(num interface{}) (*GenericNumber, bool)
func NumberFromBasicType ¶
func NumberFromBasicType(num interface{}) (*GenericNumber, bool)
func NumberFromBasicUInt ¶
func NumberFromBasicUInt(num interface{}) (*GenericNumber, bool)
func ParseNumber ¶
func ParseNumber(num interface{}) (*GenericNumber, bool)
func UIntFromString ¶
func UIntFromString(num string) (*GenericNumber, bool)
func (*GenericNumber) Above64bit ¶
func (num *GenericNumber) Above64bit() bool
func (*GenericNumber) Float ¶
func (num *GenericNumber) Float() bool
func (*GenericNumber) Float64 ¶
func (num *GenericNumber) Float64() float64
将值转换为 float64 如果 IsFloat64 == false,则返回结果是不确定的
func (*GenericNumber) Int64 ¶
func (num *GenericNumber) Int64() int64
将值转换为 int64 如果 IsInt64 == false,则返回结果是不确定的
func (*GenericNumber) String ¶
func (num *GenericNumber) String() string
func (*GenericNumber) UInt64 ¶
func (num *GenericNumber) UInt64() uint64
将值转换为 uint64 如果 IsUInt64 == false,则返回结果是不确定的
func (*GenericNumber) Unsigned ¶
func (num *GenericNumber) Unsigned() bool
type Number ¶
type Number interface {
AsNumber() *GenericNumber
}
type Stringer ¶
func ToStringer ¶
func ToStringer(v interface{}) Stringer
Click to show internal directories.
Click to hide internal directories.