Documentation ¶
Index ¶
- func ToInt(from any) (int, error)
- func ToInt16(from any) (int16, error)
- func ToInt32(from any) (int32, error)
- func ToInt64(from any) (int64, error)
- func ToInt8(from any) (int8, error)
- func ToUint(from any) (uint, error)
- func ToUint16(from any) (uint16, error)
- func ToUint32(from any) (uint32, error)
- func ToUint64(from any) (uint64, error)
- func ToUint8(from any) (uint8, error)
- func ToUintptr(from any) (uintptr, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToInt ¶
ToInt converts from to an int.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToInt16 ¶
ToInt16 converts from to an int16.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToInt32 ¶
ToInt32 converts from to an int32.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToInt64 ¶
ToInt64 converts from to an int64.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToInt8 ¶
ToInt8 converts from to an int8.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToUint ¶
ToUint converts from to an uint.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToUint16 ¶
ToUint16 converts from to an uint16.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToUint32 ¶
ToUint32 converts from to an uint32.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToUint64 ¶
ToUint64 converts from to an uint64.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToUint8 ¶
ToUint8 converts from to an uint8.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
func ToUintptr ¶
ToUintptr converts from to an uintptr.
If from is an integer or a float, a time.Duration, a time.Month or a time.Weekday a direct type convertion will be made.
If from is a bool, it will return 1 for true and 0 for false.
If from is time.Time, it will return the Unix time.
If from is a string, strconv will be used.
No other types are allowed and will result in an error.
Types ¶
This section is empty.