Documentation ¶
Overview ¶
Package coerce provides c-style coercion for numeric types and strings, with additional guarantees for preservation of information.
Index ¶
Constants ¶
View Source
const ( ErrOverflowInt64 errorlib.ErrorString = "overflow of int64" ErrImpreciseConversion errorlib.ErrorString = "data loss on conversion to float64" ErrWrongType errorlib.ErrorString = "could not coerce type" )
Variables ¶
This section is empty.
Functions ¶
func AllowImpreciseConversion ¶
func AllowImpreciseConversion(b bool)
func AllowOverflow ¶
func AllowOverflow(b bool)
func Float64 ¶
Float64 converts a numeric type to a float64, if possible. Note for very large integers, this may lose information!
func Int64 ¶
Int64 converts an integer type to an int64, if possible. Note that for very large unsigned ints, this may give an incorrect result!
func WarnOnImpreciseConversion ¶
func WarnOnImpreciseConversion(b bool)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.