# Functions
Base64Decode base64解密.
Base64Encode base64加密.
CheckAndSetDefault 检查结构体中的字段是否为空,如果为空则设置为默认值.
CompareNumber 比较两个值,如果 a < b 返回 -1,如果 a == b 返回 0,如果 a > b 返回 1,如果错误则 panic.
CopyStruct 复制结构体,将 src 的值复制到 dst
用法:CopyStruct(&src, &dst)
注意:src、dst 必须是一个指针.
GenerateSSHKey 生成 SSH 密钥.
GetFieldNameByJSONTag 根据 JSON 标记获取结构体字段名.
GetHostInfo 从http.Request中获取hostInfo.
GetSSHKey 获取 SSH 密钥,如果不存在则生成.
InArray 检查某个值是否存在于切片中 val 是要检查的值 array 是要检查的切片 exists 是返回的布尔值,表示 val 是否存在于 array 中.
IsEmptyValue 检查值是否为空.
IsError 判断[]error是否存在错误.
Json 根据传入的未知类型实例化JsonHelper.
JsonFile 根据传入的文件路径读取JSON文件并实例化JsonHelper.
Deprecated: 使用 Json 代替.
Deprecated: 使用 Json 代替.
Deprecated: 使用 Json 代替.
MapToStruct 通过reflect将map转换为结构体.
MatchWildcard 检查字符串是否匹配给定的通配符模式.
Max 返回可变参数中最大的值.
Min 返回可变参数中最小的值.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ParseIP 解析IP地址,输出是ipv4或ipv6 0: invalid ip 4: ipv4 6: ipv6.
Random 生成随机字符
参数: - length (必需): 随机字符长度。 - numericOnly (可选): 如果为 true,则只包含数字字符。
返回值: - string: 生成的随机字符串。
示例:
randomString := Random(16) randomString := Random(16, true).
No description provided by the author
SetMapStrInterface Deprecated: 请使用 NewMap.
StringEndWith 判断字符串是否以某个字符串结尾.
StringStartWith 判断字符串是否以某个字符串开头.
StrReplace 类似于php中的str_replace.
StructMerge 函数将多个源结构体中的非零值合并到目标结构体中。 源结构体按照传入顺序反向合并,后面的源结构体会覆盖前面的。 目标结构体 (dst) 必须是指向结构体的指针,所有源结构体 (src) 必须是与目标结构体类型相同的指针。
参数: - dst: 一个指向目标结构体的指针,非零值将合并到该结构体中。 - src: 一个变参,包含多个指向源结构体的指针,非零值将从这些源结构体中提取。
返回值: - error: 如果 dst 不是指向结构体的指针,或任何 src 元素不是与 dst 类型相同的结构体指针,则返回错误。.
StructToMap 通过reflect将结构体转换为map.
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author