Documentation
¶
Index ¶
- Constants
- Variables
- func AesDecrypt(text string, key []byte) (string, error)
- func AesEncrypt(text string, key []byte) (string, error)
- func Base64StdDecode(s string) string
- func Base64StdEncode(s string) string
- func Bind(source interface{}, target interface{}) error
- func BitsToSubNetMask(maskBits int) (string, error)
- func Byte2Map(b []byte) (map[string]interface{}, error)
- func CalculateNetwork(ipAddr, subnetMask string) (string, error)
- func ContainsInt64(is []int64, i int64) bool
- func CurrentDate() string
- func CurrentDateByPlace(place string) string
- func CurrentTime() string
- func CurrentTimeAppointDay(t time.Time) string
- func CurrentTimeDay() string
- func DecryptByAes(data string, key []byte) (string, error)
- func DesDecrypt(text string, key []byte) (string, error)
- func DesDecryptCBC(text string, key []byte) (string, error)
- func DesEncrypt(text string, key []byte) (string, error)
- func DesEncryptCBC(text string, key []byte) (string, error)
- func DetectTcpPort(ip string, port int, timeout time.Duration) bool
- func EachMapSort(eachMap interface{}, eachFunc interface{}) error
- func EncryptByAes(data string, key []byte) (string, error)
- func FormatDate(t time.Time) string
- func FormatMonth(t time.Time) string
- func FormatMonthChinese(t time.Time) string
- func FormatTime(t time.Time) string
- func GetInterfaceFiledValue(v interface{}, fieldName string) reflect.Value
- func GetLinesFromBuffer(buf *bytes.Buffer) []string
- func GetPageIndex(pageIndex int) int
- func GetPageNumber(count int64, pageSize int) int
- func GetPageSize(pageSize int) int
- func GetRemoteAddr(rc *app.RequestContext) string
- func GetSelfIps() map[string]map[string]string
- func GetSelfPath() string
- func GetSelfPathFull() string
- func GetSelfV4IFaceFirst() string
- func GetSelfV4IpFirst(iFace ...string) string
- func GetSelfV4Ips() map[string]string
- func GetSelfV6IFaceFirst() string
- func GetSelfV6IpFirst(iFace ...string) string
- func GetSelfV6Ips() map[string]string
- func HmacMd5(str, key string) string
- func HmacMd5WithBase64(data, key string) string
- func HmacSha1(str, key string) string
- func HmacSha1WithBase64(str, key string) string
- func HmacSha256(str, key string) string
- func HmacSha256WithBase64(str, key string) string
- func HmacSha512(str, key string) string
- func HmacSha512WithBase64(str, key string) string
- func ID() int64
- func IDString() string
- func IntConvertToIpAddress(ipInt int) (string, error)
- func InterfaceToStruct(out interface{}, in interface{}) error
- func IpAddressConvertToInt(ip string) (int, error)
- func IsUuid(obj interface{}) bool
- func IsValidIP(ipAddr string) bool
- func IsValidPort(port string) (int, error)
- func IsValidURL(u string) bool
- func MakeInstanceFromSlice(v interface{}) (i interface{}, err error)
- func MapStringValues(m map[string]string) (v []string)
- func MatchString(src, pattern string) bool
- func Md5Byte(data []byte) string
- func Md5ByteWithBase64(data []byte) string
- func Md5File(filename string) (string, error)
- func Md5String(s string) string
- func Md5StringWithBase64(s string) string
- func MustBool(value interface{}) bool
- func MustBoolArray(value interface{}) (resArray []bool)
- func MustExplodeStructField(array interface{}, field string) (explodeArray []interface{})
- func MustFloat32(value interface{}) (res float32)
- func MustFloat32Array(value interface{}) (resArray []float32)
- func MustFloat64(value interface{}) (res float64)
- func MustFloat64Array(value interface{}) (resArray []float64)
- func MustInt(value interface{}) (res int)
- func MustInt16(value interface{}) (res int16)
- func MustInt16Array(value interface{}) (resArray []int16)
- func MustInt32(value interface{}) (res int32)
- func MustInt32Array(value interface{}) (resArray []int32)
- func MustInt64(value interface{}) (res int64)
- func MustInt64Array(value interface{}) (resArray []int64)
- func MustInt8(value interface{}) (res int8)
- func MustInt8Array(value interface{}) (resArray []int8)
- func MustIntArray(value interface{}) (resArray []int)
- func MustInterfaceArray(array interface{}) []interface{}
- func MustJson(i interface{}) []byte
- func MustJsonPrettyString(i interface{}) string
- func MustJsonString(i interface{}) string
- func MustMapStringInterfaceRecursions(leafMap interface{}) map[string]interface{}
- func MustMapStringInterfaceRecursionsInArrayInterface(leafAry interface{}) []interface{}
- func MustString(value interface{}) string
- func MustStringArray(array interface{}) (resArray []string)
- func MustUint(value interface{}) (res uint)
- func MustUint16(value interface{}) (res uint16)
- func MustUint16Array(value interface{}) (resArray []uint16)
- func MustUint32(value interface{}) (res uint32)
- func MustUint32Array(value interface{}) (resArray []uint32)
- func MustUint64(value interface{}) (res uint64)
- func MustUint64Array(value interface{}) (resArray []uint64)
- func MustUint8(value interface{}) (res uint8)
- func MustUint8Array(value interface{}) (resArray []uint8)
- func MustUintArray(value interface{}) (resArray []uint)
- func NowTimeMillisecond() string
- func NowTimeSecond() string
- func Obj2ListMap(obj interface{}) ([]map[string]interface{}, error)
- func Obj2ListMapString(obj interface{}) ([]map[string]string, error)
- func Obj2Map(obj interface{}) (map[string]interface{}, error)
- func Obj2MapString(obj interface{}) (map[string]string, error)
- func ParseDate(date string) (time.Time, error)
- func ParseTime(date string) (time.Time, error)
- func Ping(ipAddr string, timeout time.Duration) bool
- func PortCheck(host string, port int) bool
- func ReTry(callback func() bool, times int, step time.Duration)
- func RemoveFirstString(slice []string) []string
- func RemoveItemsContainingSubstring(arr []string, substr string) []string
- func RemoveItemsNotContainingSubstring(arr []string, substr string) []string
- func RemoveMatchString(slice []string, pattern string, method int) []string
- func RemoveMultiSpaces(str string) string
- func RemoveTextWithinMatch(str string, pattern string, method int) string
- func RemoveTextWithinParens(str string) string
- func Result(rc *app.RequestContext, errno int, errmsg string, data interface{})
- func ResultAuthError(rc *app.RequestContext)
- func ResultError(rc *app.RequestContext, errMsg string)
- func ResultErrorData(rc *app.RequestContext, errMsg string, data interface{})
- func ResultSuccess(rc *app.RequestContext, msg string, data interface{})
- func ResultSuccessData(rc *app.RequestContext, data interface{})
- func ResultSuccessMsg(rc *app.RequestContext, msg string)
- func ResultSystemError(rc *app.RequestContext, errMsg string)
- func RunningOs(osName ...string) string
- func Sha1(str string) string
- func Sha1WithBase64(str string) string
- func Sha256(str string) string
- func Sha256WithBase64(str string) string
- func Sha512(str string) string
- func Sha512WithBase64(str string) string
- func String2Map(str string) (map[string]interface{}, error)
- func String2MapList(str string) ([]map[string]interface{}, error)
- func StringEndWith(str, suffix string) bool
- func StringEndWithIgnoreCase(str, suffix string) bool
- func StringIsEmpty(str string) bool
- func StringIsInt(str string) (int, bool)
- func StringIsInt64(str string) (int64, bool)
- func StringStartWith(str, prefix string) bool
- func StringStartWithIgnoreCase(str, prefix string) bool
- func SubNetMaskToBits(subnetMask string) (int, error)
- func ToArrayMapStr(m []map[string]interface{}) (string, error)
- func ToArrayMapString(maps []map[string]interface{}) []map[string]string
- func ToBool(value interface{}) (res bool, err error)
- func ToBoolArray(value interface{}) (resArray []bool, err error)
- func ToExplodeStructField(array interface{}, field string) (explodeArray []interface{}, err error)
- func ToFload64(value string) (float64, error)
- func ToFloat32(value interface{}) (res float32, err error)
- func ToFloat32Array(value interface{}) (resArray []float32, err error)
- func ToFloat64(value interface{}) (res float64, err error)
- func ToFloat64Array(value interface{}) (resArray []float64, err error)
- func ToInt(value interface{}) (res int, err error)
- func ToInt16(value interface{}) (res int16, err error)
- func ToInt16Array(value interface{}) (resArray []int16, err error)
- func ToInt32(value interface{}) (res int32, err error)
- func ToInt32Array(value interface{}) (resArray []int32, err error)
- func ToInt64(value interface{}) (res int64, err error)
- func ToInt64Array(value interface{}) (resArray []int64, err error)
- func ToInt8(value interface{}) (res int8, err error)
- func ToInt8Array(value interface{}) (resArray []int8, err error)
- func ToIntArray(value interface{}) (resArray []int, err error)
- func ToInterfaceArray(array interface{}) ([]interface{}, error)
- func ToInterfaceByte(m interface{}) []byte
- func ToMapByte(m map[string]interface{}) []byte
- func ToMapStr(m map[string]interface{}) (string, error)
- func ToMapString(m map[string]interface{}) map[string]string
- func ToObjStr(o interface{}) string
- func ToString(value interface{}) string
- func ToStringArray(value interface{}) ([]string, error)
- func ToStringArrayInt64(value, sep string) (arr []int64)
- func ToUint(value interface{}) (res uint, err error)
- func ToUint16(value interface{}) (res uint16, err error)
- func ToUint16Array(value interface{}) (resArray []uint16, err error)
- func ToUint32(value interface{}) (res uint32, err error)
- func ToUint32Array(value interface{}) (resArray []uint32, err error)
- func ToUint64(value interface{}) (res uint64, err error)
- func ToUint64Array(value interface{}) (resArray []uint64, err error)
- func ToUint8(value interface{}) (res uint8, err error)
- func ToUint8Array(value interface{}) (resArray []uint8, err error)
- func ToUintArray(value interface{}) (resArray []uint, err error)
- func TransTo62(id int64) string
- func TrimLeadingCharacter(str, character string) string
- func TrimLeadingCharacterIgnoreCase(str, character string) string
- func TrimTrailingCharacter(str, character string) string
- func TrimTrailingCharacterIgnoreCase(str, character string) string
- func UuidGenerate() string
- func ValidateStruct(s interface{}) error
- func XOR(plain string, key []byte) string
- type Count
- type JsonTime
- type PageData
- type PageParam
- type PageTable
- type PhoneData
- type RandID
- type UserAgentRes
Constants ¶
const ( ResultCodeSystemError = 99 // 系统级别错误 ResultCodeAuth = 2 // 权限错误 ResultCodeError = 1 // 常用错误 ResultCodeSuccess = 0 // 成功 )
const PageSize = 10
Variables ¶
var ( Validate *validator.Validate ValidateTrans ut.Translator )
Functions ¶
func Base64StdDecode ¶
Base64StdDecode decode a base64 encoded string. Play: https://go.dev/play/p/RWQylnJVgIe
func Base64StdEncode ¶
Base64StdEncode encode string with base64 encoding. Play: https://go.dev/play/p/VOaUyQUreoK
func BitsToSubNetMask ¶
BitsToSubNetMask 将掩码位数转换为子网掩码
func CalculateNetwork ¶
CalculateNetwork 根据给定的IP地址和子网掩码计算网络地址
func ContainsInt64 ¶
func CurrentDate ¶
func CurrentDate() string
func CurrentDateByPlace ¶
func CurrentTime ¶
func CurrentTime() string
func CurrentTimeAppointDay ¶
func CurrentTimeDay ¶
func CurrentTimeDay() string
func DecryptByAes ¶
DecryptByAes base64解码后 Aes 解密
func DesEncrypt ¶
DesEncrypt DES加密,秘钥必须是64位,所以key必须是长度为8的byte数组
func DetectTcpPort ¶
DetectTcpPort 检测Tcp端口是否开通
func EachMapSort ¶
func EachMapSort(eachMap interface{}, eachFunc interface{}) error
func EncryptByAes ¶
EncryptByAes Aes加密 后 base64
func FormatDate ¶
func FormatMonth ¶
func FormatMonthChinese ¶
func FormatTime ¶
func GetInterfaceFiledValue ¶
func GetLinesFromBuffer ¶
func GetPageIndex ¶
func GetPageNumber ¶
func GetPageSize ¶
func GetSelfIps ¶
func GetSelfPath ¶
func GetSelfPath() string
func GetSelfPathFull ¶
func GetSelfPathFull() string
func GetSelfV4IFaceFirst ¶
func GetSelfV4IFaceFirst() string
func GetSelfV4IpFirst ¶
func GetSelfV4Ips ¶
func GetSelfV6IFaceFirst ¶
func GetSelfV6IFaceFirst() string
func GetSelfV6IpFirst ¶
func GetSelfV6Ips ¶
func HmacMd5 ¶
HmacMd5 return the hmac hash of string use md5. Play: https://go.dev/play/p/uef0q1fz53I
func HmacMd5WithBase64 ¶
HmacMd5WithBase64 return the hmac hash of string use md5 with base64. https://go.dev/play/p/UY0ng2AefFC
func HmacSha1 ¶
HmacSha1 return the hmac hash of string use sha1. Play: https://go.dev/play/p/1UI4oQ4WXKM
func HmacSha1WithBase64 ¶
HmacSha1WithBase64 return the hmac hash of string use sha1 with base64. Play: https://go.dev/play/p/47JmmGrnF7B
func HmacSha256 ¶
HmacSha256 return the hmac hash of string use sha256. Play: https://go.dev/play/p/HhpwXxFhhC0
func HmacSha256WithBase64 ¶
HmacSha256WithBase64 return the hmac hash of string use sha256 with base64. Play: https://go.dev/play/p/EKbkUvPTLwO
func HmacSha512 ¶
HmacSha512 return the hmac hash of string use sha512. Play: https://go.dev/play/p/59Od6m4A0Ud
func HmacSha512WithBase64 ¶
HmacSha512WithBase64 return the hmac hash of string use sha512 with base64. Play: https://go.dev/play/p/c6dSe3E2ydU
func IntConvertToIpAddress ¶
IntConvertToIpAddress 将整数转换为IP地址
func InterfaceToStruct ¶
func InterfaceToStruct(out interface{}, in interface{}) error
func IpAddressConvertToInt ¶
IpAddressConvertToInt 将IP地址转换为整数
func MakeInstanceFromSlice ¶
func MakeInstanceFromSlice(v interface{}) (i interface{}, err error)
func MapStringValues ¶
func Md5Byte ¶
Md5Byte return the md5 string of byte slice. Play: https://go.dev/play/p/suraalH8lyC
func Md5ByteWithBase64 ¶
Md5ByteWithBase64 return the md5 string of byte slice with base64. Play: https://go.dev/play/p/Tcb-Z7LN2ax
func Md5String ¶
Md5String return the md5 value of string. Play: https://go.dev/play/p/1bLcVetbTOI
func Md5StringWithBase64 ¶
Md5StringWithBase64 return the md5 value of string with base64. Play: https://go.dev/play/p/Lx4gH7Vdr5_y
func MustBoolArray ¶
func MustBoolArray(value interface{}) (resArray []bool)
尽最大努力将目标转换为[]bool,失败会panic
func MustExplodeStructField ¶
func MustExplodeStructField(array interface{}, field string) (explodeArray []interface{})
func MustFloat32 ¶
func MustFloat32(value interface{}) (res float32)
func MustFloat32Array ¶
func MustFloat32Array(value interface{}) (resArray []float32)
尽最大努力将目标转换为[]float32,失败会panic
func MustFloat64 ¶
func MustFloat64(value interface{}) (res float64)
func MustFloat64Array ¶
func MustFloat64Array(value interface{}) (resArray []float64)
尽最大努力将目标转换为[]float64,失败会panic
func MustInt ¶
func MustInt(value interface{}) (res int)
强制转换为int,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustInt16 ¶
func MustInt16(value interface{}) (res int16)
强制转换为int16,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int16 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustInt16Array ¶
func MustInt16Array(value interface{}) (resArray []int16)
尽最大努力将目标转换为[]int16,失败会panic
func MustInt32 ¶
func MustInt32(value interface{}) (res int32)
强制转换为int32,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int32 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustInt32Array ¶
func MustInt32Array(value interface{}) (resArray []int32)
尽最大努力将目标转换为[]int32,失败会panic
func MustInt64 ¶
func MustInt64(value interface{}) (res int64)
强制转换为int64,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int64 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustInt64Array ¶
func MustInt64Array(value interface{}) (resArray []int64)
尽最大努力将目标转换为[]int64,失败会panic
func MustInt8 ¶
func MustInt8(value interface{}) (res int8)
强制转换为int8,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int8 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustInt8Array ¶
func MustInt8Array(value interface{}) (resArray []int8)
尽最大努力将目标转换为[]int8,失败会panic
func MustInterfaceArray ¶
func MustInterfaceArray(array interface{}) []interface{}
func MustJsonPrettyString ¶
func MustJsonPrettyString(i interface{}) string
func MustJsonString ¶
func MustJsonString(i interface{}) string
func MustMapStringInterfaceRecursions ¶
func MustMapStringInterfaceRecursions(leafMap interface{}) map[string]interface{}
把map转成map[string]interface{},key的值使用MustString计算。 如果子项中也有map,则继续递归执行直到全部转换为map[string]interface{} 如果子项有[]interface{},则要继续判定slice的元素中的类型 常用于各种xml\yaml\json转换为map的结果的统一处理。
func MustMapStringInterfaceRecursionsInArrayInterface ¶
func MustMapStringInterfaceRecursionsInArrayInterface(leafAry interface{}) []interface{}
协助处理[]interface{}中的map[interface{}]interface{}为map[string]interface{}
func MustUint ¶
func MustUint(value interface{}) (res uint)
强制转换为uint,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint;空字符串会转化为0. float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustUint16 ¶
func MustUint16(value interface{}) (res uint16)
强制转换为uint16,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint16 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustUint16Array ¶
func MustUint16Array(value interface{}) (resArray []uint16)
尽最大努力将目标转换为[]uint16,失败会panic
func MustUint32 ¶
func MustUint32(value interface{}) (res uint32)
强制转换为uint32,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint32 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustUint32Array ¶
func MustUint32Array(value interface{}) (resArray []uint32)
尽最大努力将目标转换为[]uint32,失败会panic
func MustUint64 ¶
func MustUint64(value interface{}) (res uint64)
强制转换为uint64,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint64 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustUint64Array ¶
func MustUint64Array(value interface{}) (resArray []uint64)
尽最大努力将目标转换为[]uint64,失败会panic
func MustUint8 ¶
func MustUint8(value interface{}) (res uint8)
强制转换为uint8,失败则panic string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint8 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func MustUint8Array ¶
func MustUint8Array(value interface{}) (resArray []uint8)
尽最大努力将目标转换为[]uint8,失败会panic
func MustUintArray ¶
func MustUintArray(value interface{}) (resArray []uint)
尽最大努力将目标转换为[]uint,失败会panic
func NowTimeMillisecond ¶
func NowTimeMillisecond() string
NowTimeMillisecond 获取当前时间,格式为:2006-01-02 15:04:05.0000
func Obj2ListMap ¶
func Obj2ListMapString ¶
func Obj2MapString ¶
func RemoveFirstString ¶
RemoveFirstString 从字符串数组切片里移除第一个元素
func RemoveItemsContainingSubstring ¶
RemoveItemsContainingSubstring 从字符串数组切片里移除包含substr字符串的项并移除连续空格字符
func RemoveItemsNotContainingSubstring ¶
RemoveItemsNotContainingSubstring 从字符串数组切片里移除不包含substr字符串的项并移除连续空格字符
func RemoveMatchString ¶
RemoveMatchString 按正则表达式移除字符串数组切片中的元素 method为1则移除匹配项 method为2则移除不匹配项
func RemoveMultiSpaces ¶
RemoveMultiSpaces 从字符串中移除多个连续空格字符
func RemoveTextWithinMatch ¶
RemoveTextWithinMatch 按正则表达式移除字符串中的行 method为1则移除匹配项 method为2则移除不匹配项
func RemoveTextWithinParens ¶
RemoveTextWithinParens 从字符串中删除括号内的文本。
func ResultAuthError ¶
func ResultAuthError(rc *app.RequestContext)
func ResultError ¶
func ResultError(rc *app.RequestContext, errMsg string)
func ResultErrorData ¶
func ResultErrorData(rc *app.RequestContext, errMsg string, data interface{})
func ResultSuccess ¶
func ResultSuccess(rc *app.RequestContext, msg string, data interface{})
func ResultSuccessData ¶
func ResultSuccessData(rc *app.RequestContext, data interface{})
func ResultSuccessMsg ¶
func ResultSuccessMsg(rc *app.RequestContext, msg string)
func ResultSystemError ¶
func ResultSystemError(rc *app.RequestContext, errMsg string)
func Sha1 ¶
Sha1 return the sha1 value (SHA-1 hash algorithm) of string. Play: https://go.dev/play/p/_m_uoD1deMT
func Sha1WithBase64 ¶
Sha1WithBase64 return the sha1 value (SHA-1 hash algorithm) of base64 string. Play: https://go.dev/play/p/fSyx-Gl2l2-
func Sha256 ¶
Sha256 return the sha256 value (SHA256 hash algorithm) of string. Play: https://go.dev/play/p/tU9tfBMIAr1
func Sha256WithBase64 ¶
Sha256WithBase64 return the sha256 value (SHA256 hash algorithm) of base64 string. Play: https://go.dev/play/p/85IXJHIal1k
func Sha512 ¶
Sha512 return the sha512 value (SHA512 hash algorithm) of string. Play: https://go.dev/play/p/3WsvLYZxsHa
func Sha512WithBase64 ¶
Sha512WithBase64 return the sha512 value (SHA512 hash algorithm) of base64 string. Play: https://go.dev/play/p/q_fY2rA-k5I
func String2Map ¶
func String2MapList ¶
func StringEndWithIgnoreCase ¶
StringEndWithIgnoreCase 检查字符串是否以指定的后缀结尾,忽略大小写。
func StringStartWith ¶
StringStartWith 检查字符串是否以指定的前缀开头。
func StringStartWithIgnoreCase ¶
StringStartWithIgnoreCase 检查字符串是否以指定的前缀开头,忽略大小写。
func SubNetMaskToBits ¶
SubNetMaskToBits 将子网掩码转换为掩码位数
func ToArrayMapStr ¶
func ToArrayMapString ¶
func ToBool ¶
字符串中将"1", "t", "T", "true", "TRUE", "True"转为true 将"0", "f", "F", "false", "FALSE", "False", ""转为false,空字符串也转为false 数字中仅支持将0转为false,1转为true。
func ToBoolArray ¶
尽最大努力将目标转换为[]int
func ToExplodeStructField ¶
把数组中的各个元素的指定filed取出来放到一个数组中 要求Array所有元素都是同一种类型,虽然支持指针混用但建议尽可能避免。 ary := []interface{}{foo{ID: 1, Field: "foo1"}, &foo{ID: 2, Field: "foo22"}} fieldAry := Explode(ary,"Field") // []interface{}{"foo1","foo22"}
func ToFloat32 ¶
尽最大努力将一个值转为float32类型的数据 string会按顺序尝试将数据解析为float64\uint64\bool,然后再转换为float64 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToFloat32Array ¶
尽最大努力将目标转换为[]float32
func ToFloat64 ¶
尽最大努力将一个值转为float64类型的数据 string会按顺序尝试将数据解析为float64\uint64\bool,然后再转换为float64 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToFloat64Array ¶
尽最大努力将目标转换为[]float64
func ToInt ¶
尽最大努力将一个值转为int类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToInt16 ¶
尽最大努力将一个值转为int16类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int16 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToInt16Array ¶
尽最大努力将目标转换为[]int16
func ToInt32 ¶
尽最大努力将一个值转为int32类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int32 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToInt32Array ¶
尽最大努力将目标转换为[]int32
func ToInt64 ¶
尽最大努力将一个值转为int64类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int64 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToInt64Array ¶
尽最大努力将目标转换为[]int64
func ToInt8 ¶
尽最大努力将一个值转为int8类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为int8 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToInt8Array ¶
尽最大努力将目标转换为[]int8
func ToInterfaceArray ¶
func ToInterfaceArray(array interface{}) ([]interface{}, error)
func ToInterfaceByte ¶
func ToInterfaceByte(m interface{}) []byte
func ToMapString ¶
func ToUint ¶
尽最大努力将一个值转为uint类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToUint16 ¶
尽最大努力将一个值转为uint16类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint16 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToUint16Array ¶
尽最大努力将目标转换为[]uint16
func ToUint32 ¶
尽最大努力将一个值转为uint32类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint32 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToUint32Array ¶
尽最大努力将目标转换为[]uint32
func ToUint64 ¶
尽最大努力将一个值转为uint64类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint64 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToUint64Array ¶
尽最大努力将目标转换为[]uint64
func ToUint8 ¶
尽最大努力将一个值转为uint8类型的数据 string会按顺序尝试将数据解析为int64\uint64\float64\bool,然后再转换为uint8 float会抹去小数 uint8~64、int8~64都会做默认的转换 bool类型的数据,true-1;false-0
func ToUint8Array ¶
尽最大努力将目标转换为[]uint8
func ToUintArray ¶
尽最大努力将目标转换为[]uint
func TrimLeadingCharacter ¶
TrimLeadingCharacter 从字符串中删除前导字符。
func TrimLeadingCharacterIgnoreCase ¶
TrimLeadingCharacterIgnoreCase 从字符串中删除前导字符,忽略大小写。
func TrimTrailingCharacter ¶
TrimTrailingCharacter 从字符串中删除尾随字符。
func TrimTrailingCharacterIgnoreCase ¶
TrimTrailingCharacterIgnoreCase 从字符串中删除尾随字符,忽略大小写。
func UuidGenerate ¶
func UuidGenerate() string
func ValidateStruct ¶
func ValidateStruct(s interface{}) error