Documentation
¶
Index ¶
- Variables
- func Base64Decode(v string) string
- func Base64Encode(v string) string
- func Diff(oldDatas, newDatas []map[string]interface{}, key string) (newData, updateData, delData []map[string]interface{})
- func FormatDuration(d time.Duration) (r string)
- func FromJson[T any](b string) (*T, error)
- func GenHMAC(data string, key string) string
- func GetBool(m map[string]interface{}, key string, igoreCase ...bool) bool
- func GetFloat(m map[string]interface{}, key string, igoreCase ...bool) float64
- func GetInt(m map[string]interface{}, key string, igoreCase ...bool) int
- func GetInt64(m map[string]interface{}, key string, igoreCase ...bool) int64
- func GetSignature(method, key string, queryParam map[string]string) string
- func GetSignatureFromURL(method, key, url string) (string, error)
- func GetStr(m map[string]interface{}, key string, igoreCase ...bool) string
- func GetVal[T any](m map[string]interface{}, key string, igoreCase ...bool) T
- func GetValue(m map[string]interface{}, keys []string, ignoreCase ...bool) (interface{}, error)
- func GraphSort(names []string, depGraph map[string]map[string]struct{}) ([]string, error)
- func HashInt(input string) uint32
- func IsDigits(s string) bool
- func MD5(params ...interface{}) string
- func MapToStruct[T any](m map[string]interface{}, tag ...string) (*T, error)
- func MergeMaps(m1 ...map[string]interface{}) map[string]interface{}
- func MyStringToTimeHook() mapstructure.DecodeHookFunc
- func NanoID(l ...int) string
- func NewObj[T any]() (T, bool)
- func PadStart(s string, length int, pad string) string
- func ParseQueryToMap(queryString string) (map[string]string, error)
- func ParseURLParams(url string) (string, map[string]string, error)
- func ParseUserAgent(ua string) string
- func Ptr[T any](v T) *T
- func RealVal(encodeVal string) string
- func RemoveSqlComments(line string, inMultiLineComment bool) (processedLine string, stillInComment bool)
- func ReplaceSqlStringContent(line string, expectedEnd string, vPlaceholder ...string) (processedLine string, nextExpectedEnd string)
- func SM4Decode2(v string) string
- func SM4Decrypt2(key, iv, cipherText []byte) ([]byte, error)
- func SetValue(m map[string]interface{}, keys []string, value interface{}) (map[string]interface{}, error)
- func SliceMapToSliceStruct[T any](m []map[string]interface{}, tag ...string) ([]*T, error)
- func SliceToAny[T any](s []T) []any
- func SnowflakeID() string
- func SortParam(method string, params map[string]string) string
- func StructToMap[T any](o *T, tag ...string) (map[string]interface{}, error)
- func ToBool(value interface{}) bool
- func ToFloat64(value interface{}) float64
- func ToInt(value interface{}) int
- func ToInt64(value interface{}) int64
- func ToJson[T any](d T) (string, error)
- func ToStr(value interface{}) string
- func ToTimestamp(tm time.Time) int64
- func TravelMap(m map[string]any, f func(k string, v any) error) error
- func TraverseString(s string, separatorChars string, callback CallbackFunc) error
- func UUID() string
- func WalkMapLeaves(root map[string]any, f func(path string, v any) error) error
- func XID() string
- type CallbackFunc
- type DelimiterInfo
- type WordInfo
Constants ¶
This section is empty.
Variables ¶
var ( PUB_VALUE = "Cyclone890123456" IV = "1234567890123456" )
var ToString = ToStr
Functions ¶
func Base64Decode ¶
func Base64Encode ¶
func FormatDuration ¶
FormatDuration formats a time.Duration into a human-readable string with appropriate units (ns, µs, ms, s) based on the duration's magnitude. This is useful for logging request latencies in a more readable format.
func GetSignature ¶
GetSignature generates a signature for API requests method: HTTP method (GET, POST, etc.) key: Secret key for signing queryParam: Map of query parameters
func GetSignatureFromURL ¶
GetSignatureFromURL generates a signature from a URL string method: HTTP method (GET, POST, etc.) key: Secret key for signing url: Full URL including query parameters
func MyStringToTimeHook ¶
func MyStringToTimeHook() mapstructure.DecodeHookFunc
func ParseQueryToMap ¶
ParseQueryToMap converts a query string to a map of parameters
func ParseURLParams ¶
ParseURLParams parses URL parameters into a map
func ParseUserAgent ¶
ParseUserAgent extracts OS and browser information from a user agent string Returns a simplified string with OS type/version and browser type/version
func RemoveSqlComments ¶
func ReplaceSqlStringContent ¶
func SM4Decode2 ¶
func SM4Decrypt2 ¶
func SliceMapToSliceStruct ¶
func SliceToAny ¶
func SnowflakeID ¶
func SnowflakeID() string
func ToTimestamp ¶
func TraverseString ¶
func TraverseString(s string, separatorChars string, callback CallbackFunc) error
traverseString tokenizes a string and calls a callback for each word found.
func WalkMapLeaves ¶
Types ¶
type CallbackFunc ¶
type DelimiterInfo ¶
DelimiterInfo 用于存储找到的分隔符信息
func FindDelimiters ¶
func FindDelimiters(str, sep string) []DelimiterInfo
FindDelimiters 查找字符串 str 中所有由 sep 组成的连续分隔符 返回包含分隔符内容和起始位置的 DelimiterInfo 切片