Documentation
¶
Overview ¶
Package convertor implements some functions to convert data.
Package convertor implements some functions to convert data.
Index ¶
- func ColorHexToRGB(colorHex string) (red, green, blue int)
- func ColorRGBToHex(red, green, blue int) string
- func CopyProperties(dst, src interface{}) error
- func DecodeByte(data []byte, target interface{}) error
- func DeepClone(src interface{}) interface{}
- func EncodeByte(data interface{}) ([]byte, error)
- func GbkToUtf8(bs []byte) ([]byte, error)
- func MapToStruct(m map[string]interface{}, structObj interface{}) error
- func StructToMap(value interface{}) (map[string]interface{}, error)
- func ToBigInt(v interface{}) (*big.Int, error)
- func ToBool(s string) (bool, error)
- func ToBytes(value interface{}) ([]byte, error)
- func ToChannel(array []interface{}) <-chan interface{}
- func ToChar(s string) []string
- func ToFloat(value interface{}) (float64, error)
- func ToInt(value interface{}) (int64, error)
- func ToInterface(v reflect.Value) (value interface{}, ok bool)
- func ToJson(value interface{}) (string, error)
- func ToRawStdBase64(value interface{}) string
- func ToRawUrlBase64(value interface{}) string
- func ToStdBase64(value interface{}) string
- func ToString(value interface{}) string
- func ToUrlBase64(value interface{}) string
- func Utf8ToGbk(bs []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorHexToRGB ¶
ColorHexToRGB convert hex color to rgb color
func ColorRGBToHex ¶
ColorRGBToHex convert rgb color to hex color
func CopyProperties ¶ added in v1.3.7
func CopyProperties(dst, src interface{}) error
CopyProperties copies each field from the source into the destination. It recursively copies struct pointers and interfaces that contain struct pointers. use json.Marshal/Unmarshal, so json tag should be set for fields of dst and src struct.
func DecodeByte ¶ added in v1.3.2
DecodeByte decode byte data to target object
func DeepClone ¶ added in v1.3.6
func DeepClone(src interface{}) interface{}
DeepClone creates a deep copy of passed item. can't clone unexported field of struct
func EncodeByte ¶ added in v1.3.2
EncodeByte encode data to byte
func MapToStruct ¶ added in v1.4.3
MapToStruct converts map to struct
func StructToMap ¶
StructToMap convert struct to map, only convert exported struct field map key is specified same as struct field tag `json` value
func ToBigInt ¶ added in v1.4.5
ToBigInt converts an integer of any supported type (int, int64, uint64, etc.) to *big.Int Play: todo
func ToChannel ¶ added in v1.3.1
func ToChannel(array []interface{}) <-chan interface{}
ToChannel convert a array of elements to a read-only channels
func ToInterface ¶ added in v1.3.9
ToInterface converts reflect value to its interface type.
func ToRawStdBase64 ¶ added in v1.4.3
func ToRawStdBase64(value interface{}) string
ToRawStdBase64 convert data to raw standard base64 encoding.
func ToRawUrlBase64 ¶ added in v1.4.3
func ToRawUrlBase64(value interface{}) string
ToRawUrlBase64 convert data to raw URL base64 encoding.
func ToStdBase64 ¶ added in v1.4.3
func ToStdBase64(value interface{}) string
ToStdBase64 convert data to standard base64 encoding.
func ToUrlBase64 ¶ added in v1.4.3
func ToUrlBase64(value interface{}) string
ToUrlBase64 convert data to URL base64 encoding.
Types ¶
This section is empty.