Documentation ¶
Index ¶
- func ColorHexToRGB(colorHex string) (red, green, blue int)
- func ColorRGBToHex(red, green, blue int) string
- func CopyProperties[T, U any](dst *U, src T) error
- func DecodeByte(data []byte, target any) error
- func DeepClone[T any](src T) T
- func EncodeByte(data any) ([]byte, error)
- func GbkToUtf8(bs []byte) ([]byte, error)
- func MapToSlice[T any, K comparable, V any](aMap map[K]V, iteratee func(K, V) T) []T
- func StructToMap(value any) map[string]string
- func ToBool(s string) (bool, error)
- func ToBytes(value any) ([]byte, error)
- func ToChannel[T any](array []T) <-chan T
- func ToChar(s string) []string
- func ToFloat(value any) (float64, error)
- func ToInt(value any) (int64, error)
- func ToInterface(v reflect.Value) (value interface{}, ok bool)
- func ToJson(value any) (string, error)
- func ToMap[T any, K comparable, V any](array []T, iteratee func(T) (K, V)) map[K]V
- func ToPointer[T any](value T) *T
- func ToString(value any) 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 ¶
CopyProperties copies each field from the source into the destination. It recursively copies struct pointers and interfaces that contain struct pointers.
func DecodeByte ¶
DecodeByte decode byte slice data to target object.
func DeepClone ¶
func DeepClone[T any](src T) T
DeepClone creates a deep copy of passed item. can't clone unexported field of struct
func MapToSlice ¶
func MapToSlice[T any, K comparable, V any](aMap map[K]V, iteratee func(K, V) T) []T
MapToSlice convert map to slice based on iteratee function.
func StructToMap ¶
StructToMap convert struct to map, only convert exported struct field map key is specified same as struct field tag `json` value.
func ToChannel ¶
func ToChannel[T any](array []T) <-chan T
ToChannel convert a slice of elements to a read-only channel.
func ToInterface ¶
ToInterface converts reflect value to its interface type.
func ToMap ¶
func ToMap[T any, K comparable, V any](array []T, iteratee func(T) (K, V)) map[K]V
ToMap convert a slice of structs to a map based on iteratee function.
Types ¶
This section is empty.