Documentation ¶
Index ¶
- func BytesToString(b []byte) string
- func CsvToInt64s(strValue string) []int64
- func GenerateRandString(n int) string
- func GetPagePositions(data interface{}, pageSize int) [][]int
- func GetSliceData(data interface{}) []interface{}
- func GetVarName(myvar interface{}) string
- func Int64SliceContains(list []int64, checkItem int64) bool
- func Int64sToCsv(int64s []int64) string
- func IntSliceContains(list []int, checkItem int) bool
- func IsAlphanumeric(s string) bool
- func IsImageData(data []byte) bool
- func IsValidBeginEndTime(strBeginTime, strEndTime string) error
- func LogDebug(msg string, keyvals ...interface{})
- func LogError(msg string, keyvals ...interface{})
- func LogFatal(msg string, keyvals ...interface{})
- func LogWarn(msg string, keyvals ...interface{})
- func ParseArgsWithError(keyvals ...interface{}) (error, map[string]interface{})
- func ParseArgsWithMsgError(keyvals ...interface{}) (string, error, map[string]interface{})
- func ParseStrTime(value string) (*time.Time, error)
- func RecordErrorStack(app string)
- func RemoveInvisibleCharacter(origStr string) string
- func ReverseInt64Slice(numbers []int64) []int64
- func String(value interface{}) (string, error)
- func StringSliceContains(list []string, checkItem string) bool
- func StringToBytes(s string) []byte
- func ToFixed(num float64, precision int) float64
- func ToInt64Slice(strSlice []string) []int64
- func ToStringSlice(int64Slice []int64) []string
- type LogLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation.
func CsvToInt64s ¶
CsvToInt64s 将逗号分隔的string尝试转换成[1,2,3...]的int64 slice Csv means Comma Separated Value
func GetPagePositions ¶
GetPagePositions 获取分页的起始值列表 @return 返回一个二维数组, 第一维是多少页,第二维是每页[]int{start, end} e,g: 假设11个数的列表,分页pageSize是5,那么返回的是:
[]int{ []int{0, 5}, []int{5, 10}, []int{10, 11}, }
func GetSliceData ¶
func GetSliceData(data interface{}) []interface{}
GetSliceData 将传过来的数据转换成[]interface{}
func Int64SliceContains ¶
Int64SliceContains 检查整型slice中是否含有
func Int64sToCsv ¶
Int64sToCsv 将int64 slice转换成用逗号分隔的字符串: 1,2,3
func IntSliceContains ¶
IntSliceContains 检查整型slice中是否含有
func IsAlphanumeric ¶
IsAlphanumeric check if the string contains only letters and numbers. Empty string is valid.
func IsValidBeginEndTime ¶
IsValidBeginEndTime check if it is valid begin/end time
func ParseArgsWithError ¶
ParseArgsWithError 将可变参数转换成map, 其中有err关键字返回error @author Ryan Fan @param variadic arguments, key/value键值对,可变参数个数必须为偶数 @return 错误值 @return 除错误值以外的其他参数key->value对
func ParseArgsWithMsgError ¶
ParseArgsWithMsgError 将可变参数转换成map, 其中有err关键字返回error, 有msg关键子返回msg value @author Ryan Fan @param variadic arguments, key/value键值对,可变参数个数必须为偶数 @return 错误值 @return 除错误值以外的其他参数key->value对
func ParseStrTime ¶
ParseStrTime iso time string转化为时间,layout必须为 "2006-01-02 15:04:05"
func RemoveInvisibleCharacter ¶
RemoveInvisibleCharacter 去除掉不能显示的字符
func ReverseInt64Slice ¶
ReverseInt64Slice 将[]int64 slice倒序重新排列
func StringSliceContains ¶
StringSliceContains 检查字符串slice中是否含有
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func ToInt64Slice ¶
ToInt64Slice 将string slice转换成[1,2,3...]的int64 slice
func ToStringSlice ¶
ToStringSlice 将int64 slice转换成["1", "2", "3"...]字符串slice