2020-04-28 12:46:03 +00:00
|
|
|
// Package convert provides functions for type conversion.
|
|
|
|
package convert
|
|
|
|
|
|
|
|
// ToInteger converts it's argument to an Integer.
|
2021-03-04 10:14:24 +00:00
|
|
|
func ToInteger(v interface{}) int {
|
|
|
|
return v.(int)
|
2020-04-28 12:46:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ToByteArray converts it's argument to a ByteArray.
|
|
|
|
func ToByteArray(v interface{}) []byte {
|
2021-03-02 11:43:58 +00:00
|
|
|
return v.([]byte)
|
2020-04-28 12:46:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ToBool converts it's argument to a Boolean.
|
|
|
|
func ToBool(v interface{}) bool {
|
2021-03-02 11:43:58 +00:00
|
|
|
return v.(bool)
|
2020-04-28 12:46:03 +00:00
|
|
|
}
|