Documentation ¶
Overview ¶
Package gconv implements powerful and easy-to-use converting functionality for any types of variables.
Index ¶
- func Bool(i interface{}) bool
- func Byte(i interface{}) byte
- func Bytes(i interface{}) []byte
- func Convert(i interface{}, t string, params ...interface{}) interface{}
- func Float32(i interface{}) float32
- func Float32s(i interface{}) []float32
- func Float64(i interface{}) float64
- func Float64s(i interface{}) []float64
- func Floats(i interface{}) []float64
- func Int(i interface{}) int
- func Int16(i interface{}) int16
- func Int32(i interface{}) int32
- func Int32s(i interface{}) []int32
- func Int64(i interface{}) int64
- func Int64s(i interface{}) []int64
- func Int8(i interface{}) int8
- func Interfaces(i interface{}) []interface{}
- func Ints(i interface{}) []int
- func IsArray(value interface{}) bool
- func IsEmpty(value interface{}) bool
- func IsLetterLower(b byte) bool
- func IsLetterUpper(b byte) bool
- func IsNil(value interface{}) bool
- func IsNumeric(s string) bool
- func ReplaceByMap(origin string, replaces map[string]string) string
- func Rune(i interface{}) rune
- func Runes(i interface{}) []rune
- func SliceAny(i interface{}) []interface{}
- func SliceFloat(i interface{}) []float64
- func SliceFloat32(i interface{}) []float32
- func SliceFloat64(i interface{}) []float64
- func SliceInt(i interface{}) []int
- func SliceInt32(i interface{}) []int32
- func SliceInt64(i interface{}) []int64
- func SliceStr(i interface{}) []string
- func SliceUint(i interface{}) []uint
- func SliceUint32(i interface{}) []uint32
- func SliceUint64(i interface{}) []uint64
- func String(i interface{}) string
- func Strings(i interface{}) []string
- func UcFirst(s string) string
- func Uint(i interface{}) uint
- func Uint16(i interface{}) uint16
- func Uint32(i interface{}) uint32
- func Uint32s(i interface{}) []uint32
- func Uint64(i interface{}) uint64
- func Uint64s(i interface{}) []uint64
- func Uint8(i interface{}) uint8
- func Uints(i interface{}) []uint
- func UnsafeBytesToStr(b []byte) string
- func UnsafeStrToBytes(s string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
func Bool(i interface{}) bool
Bool converts <i> to bool. It returns false if <i> is: false, "", 0, "false", "off", "no", empty slice/map.
func Convert ¶
func Convert(i interface{}, t string, params ...interface{}) interface{}
Convert converts the variable <i> to the type <t>, the type <t> is specified by string. The optional parameter <params> is used for additional necessary parameter for this conversion. It supports common types conversion as its conversion based on type name string.
func Interfaces ¶
func Interfaces(i interface{}) []interface{}
Interfaces converts <i> to []interface{}.
func IsArray ¶
func IsArray(value interface{}) bool
IsArray checks whether given value is array/slice. Note that it uses reflect internally implementing this feature.
func IsEmpty ¶
func IsEmpty(value interface{}) bool
IsEmpty checks whether given <value> empty. It returns true if <value> is in: 0, nil, false, "", len(slice/map/chan) == 0. Or else it returns true.
func IsLetterLower ¶
IsLetterLower tests whether the given byte b is in lower case.
func IsLetterUpper ¶
IsLetterUpper tests whether the given byte b is in upper case.
func IsNil ¶
func IsNil(value interface{}) bool
IsNil checks whether given <value> is nil. Note that it might use reflect feature which affects performance a little bit.
func IsNumeric ¶
IsNumeric tests whether the given string s is numeric. Note that float string like "123.456" is also numeric.
func ReplaceByMap ¶
ReplaceByMap returns a copy of <origin>, which is replaced by a map in unordered way, case-sensitively.
func String ¶
func String(i interface{}) string
String converts <i> to string. It's most common used converting function.
func UcFirst ¶
UcFirst returns a copy of the string s with the first letter mapped to its upper case.
func UnsafeBytesToStr ¶
UnsafeBytesToStr converts []byte to string without memory copy. Note that, if you completely sure you will never use <s> in the feature, you can use this unsafe function to implement type conversion in high performance.
func UnsafeStrToBytes ¶
UnsafeStrToBytes converts string to []byte without memory copy. Note that, if you completely sure you will never use <s> in the feature, you can use this unsafe function to implement type conversion in high performance.
Types ¶
This section is empty.