Documentation ¶
Overview ¶
Copyright © 2020 RCTIPlus <rctiplus.com>. almasbub package provides an easy and safe datatype cast in Go.
Index ¶
- func ToBool(i interface{}) bool
- func ToDuration(i interface{}) time.Duration
- func ToFloat32(i interface{}) float32
- func ToFloat64(i interface{}) float64
- func ToInt(i interface{}) int
- func ToInt16(i interface{}) int16
- func ToInt32(i interface{}) int32
- func ToInt64(i interface{}) int64
- func ToInt8(i interface{}) int8
- func ToString(i interface{}) string
- func ToStringDate(i string) (time.Time, error)
- func ToTime(i interface{}) time.Time
- func ToUint(i interface{}) uint
- func ToUint16(i interface{}) uint16
- func ToUint32(i interface{}) uint32
- func ToUint64(i interface{}) uint64
- func ToUint8(i interface{}) uint8
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToBool ¶
func ToBool(i interface{}) bool
ToBool return casts of an interface to a bool type. v := almasbub.ToBool(1) fmt.Println(v) Output: true
func ToDuration ¶
ToDuration return casts of an interface to a time.Duration type. v := almasbub.ToDuration(1) fmt.Println(v) Output: true
func ToFloat32 ¶
func ToFloat32(i interface{}) float32
ToFloat32 return casts of an interface to a float32 type. v := almasbub.ToFloat32(1) fmt.Println(v) Output: true
func ToFloat64 ¶
func ToFloat64(i interface{}) float64
ToFloat64 return casts of an interface to a float64 type. v := almasbub.ToFloat64(1) fmt.Println(v) Output: true
func ToInt ¶
func ToInt(i interface{}) int
ToInt return casts of an interface to an int type. v := almasbub.ToInt(1) fmt.Println(v) Output: true
func ToInt16 ¶
func ToInt16(i interface{}) int16
ToInt16 return casts of an interface to an int16 type. v := almasbub.ToInt16(1) fmt.Println(v) Output: true
func ToInt32 ¶
func ToInt32(i interface{}) int32
ToInt32 return casts of an interface to an int32 type. v := almasbub.ToInt32(1) fmt.Println(v) Output: true
func ToInt64 ¶
func ToInt64(i interface{}) int64
ToInt64 return casts of an interface to an int64 type. v := almasbub.ToInt64(1) fmt.Println(v) Output: true
func ToInt8 ¶
func ToInt8(i interface{}) int8
ToInt8 return casts of an interface to an int8 type. v := almasbub.ToInt8(1) fmt.Println(v) Output: true
func ToString ¶
func ToString(i interface{}) string
ToString return casts of an interface to a string type. v := almasbub.ToString(1) fmt.Println(v) Output: true
func ToStringDate ¶
ToStringDate return casts of an string time intto a time type and error if failed. v := almasbub.ToStringDate(1) fmt.Println(v) Output: true
func ToTime ¶
ToTime return casts of an interface to a time.Time type. v := almasbub.ToTime(30) fmt.Println(v) Output: 30
func ToUint ¶
func ToUint(i interface{}) uint
ToUint return casts of an interface to a uint type. v := almasbub.ToUint(1) fmt.Println(v) Output: true
func ToUint16 ¶
func ToUint16(i interface{}) uint16
ToUint16 return casts of an interface to a uint16 type. v := almasbub.ToUint16(1) fmt.Println(v) Output: true
func ToUint32 ¶
func ToUint32(i interface{}) uint32
ToUint32 return casts of an interface to a uint32 type. v := almasbub.ToUint32(1) fmt.Println(v) Output: true
Types ¶
This section is empty.