Documentation
¶
Index ¶
- func Base64Decode(src string) (string, error)
- func Base64Encode(src string) string
- func Base64ToBytes(s string) ([]byte, error)
- func BaseToInt(s string, base int) (int64, error)
- func BaseToUint(s string, base int) (uint64, error)
- func BinaryToDecimal(s string) (int64, error)
- func BytesToBase64(bys []byte) string
- func BytesToFloat32(bys []byte) float32
- func BytesToFloat64(bys []byte) float64
- func BytesToHexString(bys []byte) string
- func BytesToInt(bys []byte) int
- func BytesToInt32(bys []byte, length int) int32
- func BytesToInt64(bys []byte) int64
- func BytesToUint(bys []byte) uint
- func BytesToUint32(bys []byte) uint32
- func BytesToUint64(bys []byte) uint64
- func CamelToUnderscore(src string) string
- func CompactJSON(jsonStr string) (string, error)
- func DecimalToBinary(n int64) string
- func DecimalToHex(n int64) string
- func Float32ToBytes(f float32) []byte
- func Float64ToBytes(f float64) []byte
- func FromJSON(jsonStr string, v interface{}) error
- func GetJSONField(jsonStr string, fieldPath string) (interface{}, error)
- func HexStringToBytes(s string) ([]byte, error)
- func HexToDecimal(s string) (int64, error)
- func IntSliceToString(src []int, sep string) string
- func IntToBase(n int64, base int) string
- func IntToBitBytes(n int, length int) []byte
- func IsValidJSON(jsonStr string) bool
- func JSONToMap(jsonStr string) (map[string]interface{}, error)
- func JSONToSlice(jsonStr string) ([]interface{}, error)
- func MacSplitWithColon(src string) string
- func MacSplitWithDash(src string) string
- func MapKeys[K comparable, V any](m map[K]V) []K
- func MapToSlice[K comparable, V any](m map[K]V) []V
- func MapValues[K comparable, V any](m map[K]V) []V
- func PrettyPrintJSON(jsonStr string) (string, error)
- func SetJSONField(jsonStr string, fieldPath string, value interface{}) (string, error)
- func SliceToMap[T any](slice []T, keyFunc func(T) string) map[string]T
- func SliceToString(src []interface{}, sep string) string
- func SortDecimals(decimals []decimal.Decimal, asc bool)
- func SortFloat64s(floats []float64, asc bool)
- func SortInts(ints []int, asc bool)
- func SortStrings(strings []string, asc bool)
- func SplitClean(src string) []string
- func SplitDefault(src string) []string
- func SplitTrimSpace(src string) []string
- func StringToMap(src string, kvSep string, pairSep string) map[string]string
- func StringToSlice(src string, sep string) []string
- func ToBool(src interface{}) bool
- func ToFloat64(src interface{}) float64
- func ToInt(src interface{}) int
- func ToInt64(src interface{}) int64
- func ToJSON(v interface{}) (string, error)
- func ToPrettyJSON(v interface{}) (string, error)
- func ToString(src interface{}) string
- func ToUint(src interface{}) uint
- func ToUint64(src interface{}) uint64
- func UintToBase(n uint64, base int) string
- func UnderscoreToCamel(src string) string
- func UrlDecode(src string) (string, error)
- func UrlEncode(src string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode decodes a base64 string
func Base64ToBytes ¶
Base64ToBytes converts a base64 string to a byte array
func BaseToInt ¶
BaseToInt converts a string representation in the specified base to an integer
func BaseToUint ¶
BaseToUint converts a string representation in the specified base to an unsigned integer
func BinaryToDecimal ¶
BinaryToDecimal converts a binary string to a decimal integer
func BytesToBase64 ¶
BytesToBase64 converts a byte array to a base64 string
func BytesToFloat32 ¶
BytesToFloat32 converts a byte array to float32
func BytesToFloat64 ¶
BytesToFloat64 converts a byte array to float64
func BytesToHexString ¶
BytesToHexString converts a byte array to a hexadecimal string
func BytesToUint32 ¶
BytesToUint32 converts a byte array to uint32
func BytesToUint64 ¶
BytesToUint64 converts a byte array to uint64
func CompactJSON ¶
CompactJSON removes whitespace from a JSON string
func DecimalToBinary ¶
DecimalToBinary converts a decimal integer to a binary string
func DecimalToHex ¶
DecimalToHex converts a decimal integer to a hexadecimal string
func Float32ToBytes ¶
Float32ToBytes converts a float32 to a byte array
func Float64ToBytes ¶
Float64ToBytes converts a float64 to a byte array
func FromJSON ¶
FromJSON converts a JSON string to a Go value
func GetJSONField ¶
GetJSONField extracts a specific field from a JSON string
func HexStringToBytes ¶
HexStringToBytes converts a hexadecimal string to a byte array
func HexToDecimal ¶
HexToDecimal converts a hexadecimal string to a decimal integer
func IntToBase ¶
IntToBase converts an integer to a string representation in the specified base
func IsValidJSON ¶
IsValidJSON checks if a string is valid JSON
func JSONToMap ¶
JSONToMap converts a JSON string to a map[string]interface{}
func JSONToSlice ¶
JSONToSlice converts a JSON string to a []interface{}
func MapKeys ¶
func MapKeys[K comparable, V any](m map[K]V) []K
MapKeys returns all keys from a map as a slice
func MapToSlice ¶
func MapToSlice[K comparable, V any](m map[K]V) []V
MapToSlice converts a map to a slice
func MapValues ¶
func MapValues[K comparable, V any](m map[K]V) []V
MapValues returns all values from a map as a slice
func PrettyPrintJSON ¶
PrettyPrintJSON formats a JSON string with proper indentation
func SetJSONField ¶
SetJSONField sets a specific field in a JSON string
func SliceToMap ¶
SliceToMap converts a slice to a map using the provided key function keyFunc should return a string key for each element in the slice
func SortDecimals ¶
SortDecimals sorts a slice of decimal.Decimal in ascending order. If asc is true, the slice will be sorted in ascending order; otherwise, it will be sorted in descending order. asc mode the first element will be the smallest value. desc mode the first element will be the largest value.
func SortFloat64s ¶
SortFloat64s sorts a slice of float64 values in ascending or descending order
func SortInts ¶
SortInts sorts a slice of integers in ascending or descending order
func SortStrings ¶
SortStrings sorts a slice of strings in ascending or descending order
func StringToMap ¶
StringToMap converts a string to a map using the specified key-value separator and pair separator Example: "key1=value1,key2=value2" with kvSep="=" and pairSep="," returns {"key1":"value1", "key2":"value2"}
func StringToSlice ¶
StringToSlice converts a string to a slice using the specified separator
func ToJSON ¶
ToJSON converts a Go value to a JSON string
func ToPrettyJSON ¶
ToPrettyJSON converts a Go value to a pretty-printed JSON string
func UintToBase ¶
UintToBase converts an unsigned integer to a string representation in the specified base
func UnderscoreToCamel ¶
UnderscoreToCamel converts snake_case to camelCase
Types ¶
This section is empty.
Source Files
¶
- bytes.go
- json.go
- numeric.go
- sort.go
- strings.go