Documentation ¶
Overview ¶
gen by iyfiysi at 2020-08-02 22:41:29.8925854 +0800 CST m=+13.803003301
gen by iyfiysi at 2020-08-02 22:41:29.9166513 +0800 CST m=+13.827069201
Index ¶
- Constants
- Variables
- func Base64Encode(data []byte) (str string)
- func CopyFile(srcFileName, dsrFileName string) (err error)
- func CopyStuct(dst interface{}, src interface{}) (err error)
- func DayTs() uint
- func DeferWhenCoreDump()
- func DelPath(pathName string)
- func Elasped(start time.Time) int
- func GetBetweenStr(str, start, end string) string
- func GetCurrPath() (currPath string)
- func GetGoPath() (goPath string)
- func GetKeysByTag(structVal interface{}, tagName string) (keys []string)
- func GetLowwerCase() string
- func GetStrDigit() string
- func GetUpperCase() string
- func GoID() int
- func HmacSha1(data []byte, key string) []byte
- func HmacSha256(data []byte, key string) []byte
- func InitLogger(logDir string, logLever zapcore.Level)
- func IsPathExist(pathName string) (exist bool)
- func JsonStr2Map(jsonStr string) (m map[string]interface{}, err error)
- func KSort(srcMap map[string]string) (sortStr string)
- func Md5sum(data []byte) string
- func NewJsonLogger(filePath string, level zapcore.Level, maxSize int, maxBackups int, maxAge int, ...) *zap.Logger
- func NewLogger(filePath string, level zapcore.Level, maxSize int, maxBackups int, maxAge int, ...) *zap.Logger
- func Now() uint
- func NowHourTs() uint
- func NowMs() uint64
- func Num2Str(num interface{}) (str string)
- func ParseDateStr2Ts(dateStr string) (ts uint, err error)
- func ParseHourTimeStr2Ts(hourTimeStr string) (hourTs uint, err error)
- func RandInt() int
- func RandIntn(start, end int) int
- func RandN(n int) int
- func RandStr(l int) string
- func Sha1sum(data []byte) string
- func Sha256sum(data []byte) string
- func Shuffle(data []string)
- func SortStringIntMapDesc(data map[string]interface{}) (result []string)
- func SplitBeforeBySeps(str string, seps []string) (splitList []string)
- func SplitBySeps(str string, seps []string) (splitList []string)
- func Str2Float(str string) (num float64, err error)
- func Str2Num(str string) (num int64)
- func Struct2Str(v interface{}) (str string)
- func TrimPunct(str string) (trimStr string)
- func U2S(form string) (to string, err error)
- func UUID() (id int64)
- func UniqueStringList(src []string) (dst []string)
- func WriteFile(absFileName string, data []byte) (err error)
Constants ¶
View Source
const CRLF = "\n"
Variables ¶
View Source
var ApiLogger *zap.Logger
View Source
var DBLogger *zap.Logger
View Source
var GrpcLogger *zap.Logger
View Source
var HttpLogger *zap.Logger
View Source
var MainLogger *zap.Logger
Functions ¶
func Base64Encode ¶
func DeferWhenCoreDump ¶
func DeferWhenCoreDump()
func GetBetweenStr ¶
func GetKeysByTag ¶
func GetLowwerCase ¶
func GetLowwerCase() string
func GetStrDigit ¶
func GetStrDigit() string
func GetUpperCase ¶
func GetUpperCase() string
func HmacSha256 ¶
func InitLogger ¶
func IsPathExist ¶
func JsonStr2Map ¶
func NewJsonLogger ¶
func NewLogger ¶
func NewLogger(filePath string, level zapcore.Level, maxSize int, maxBackups int, maxAge int, compress bool, serviceName string) *zap.Logger
*
- 获取日志
- filePath 日志文件路径
- level 日志级别
- maxSize 每个日志文件保存的最大尺寸 单位:M
- maxBackups 日志文件最多保存多少个备份
- maxAge 文件最多保存多少天
- compress 是否压缩
- serviceName 服务名
func ParseDateStr2Ts ¶
hourTimeStr=2020-03-20 hourTs= 1571706600
func ParseHourTimeStr2Ts ¶
hourTimeStr=09:10 hourTs= 1571706600
func SortStringIntMapDesc ¶
func SplitBeforeBySeps ¶
和SplitBySeps功能一致,不过,其会将sep附加在分割后的句子的前面 举例:"say:hello worldsay:ggg"
func SplitBySeps ¶
分割字符串:使用sepList来分割 举例: str=hello world##hello world2#. sepList=[]string{"##","#."} ret:
[]string{"hello world","hello world2"}
若是str不存在sepList,则返回为空list([]string{})
func Str2Float ¶
string to float64 "123.435"=>123.435 "123.435hahahha"=>123.435 "123.435hahahh567.123"=>123.435 "hahah"=>err
func Struct2Str ¶
func Struct2Str(v interface{}) (str string)
func UniqueStringList ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.