Documentation ¶
Overview ¶
* @Author: lisheng * @Date: 2022-10-29 11:14:13 * @LastEditTime: 2023-02-28 19:25:25 * @LastEditors: lisheng * @Description: covert A类型 To B类型 * @FilePath: /jf-go-kit/base/convert.go
* @Author: lisheng * @Date: 2023-01-16 16:21:31 * @LastEditTime: 2023-01-17 15:19:31 * @LastEditors: lisheng * @Description: * @FilePath: /jf-go-kit/base/error.go
* @Author: lisheng * @Date: 2022-10-29 11:16:36 * @LastEditTime: 2022-10-29 11:16:46 * @LastEditors: lisheng * @Description: 文件创建和检测 * @FilePath: /gitee.com/liqiyuworks/jf-go-kit/base/file.go
* @Author: lisheng * @Date: 2022-10-14 23:34:41 * @LastEditTime: 2022-11-18 09:57:18 * @LastEditors: lisheng * @Description: 日志模块 * @FilePath: /gitee.com/liqiyuworks/jf-go-kit/base/log.go
* @Author: lisheng * @Date: 2022-10-29 11:42:37 * @LastEditTime: 2022-10-29 11:47:17 * @LastEditors: lisheng * @Description: 合并各种类型模块 * @FilePath: /gitee.com/liqiyuworks/jf-go-kit/base/merge.go
* @Author: lisheng * @Date: 2022-10-11 14:29:08 * @LastEditTime: 2022-11-02 23:02:33 * @LastEditors: lisheng * @Description: 通用json返回模块 * @FilePath: /gitee.com/liqiyuworks/jf-go-kit/base/response.go
* @Author: lisheng * @Date: 2022-10-29 11:20:48 * @LastEditTime: 2022-10-29 11:58:45 * @LastEditors: lisheng * @Description: 保留小数的精度 * @FilePath: /gitee.com/liqiyuworks/jf-go-kit/base/round.go
* @Author: lisheng * @Date: 2023-01-16 16:38:45 * @LastEditTime: 2023-02-24 17:22:42 * @LastEditors: lisheng * @Description: * @FilePath: /jf-go-kit/base/sort.go
* @Author: lisheng * @Date: 2022-10-29 11:21:17 * @LastEditTime: 2022-12-23 17:30:20 * @LastEditors: lisheng * @Description: * @FilePath: /jf-go-kit/base/string.go
* @Author: lisheng * @Date: 2022-10-29 11:18:30 * @LastEditTime: 2022-12-17 16:59:09 * @LastEditors: lisheng * @Description: 时间模块 * @FilePath: /jf-go-kit/base/time.go
Index ¶
- Variables
- func CheckDir(dirPath string) error
- func CheckErr(err error, msg string)
- func ConvertByteToString(bytes []byte) string
- func ConvertCamelToCase(name string) string
- func ConvertCamelToSlash(name string) string
- func ConvertCaseToCamel(name string) string
- func ConvertInt64ToString(i int64, defaultValue string) (ret string)
- func ConvertJsonToMap(stringData string, mapData *map[string]interface{})
- func ConvertMapToJson(mapData map[string]interface{}) string
- func ConvertStringToByte(s string) []byte
- func ConvertStructToMap(i interface{}, defaultValue interface{}, ret interface{})
- func ConvertToFloat64(i interface{}, defaultValue float64) (ret float64)
- func ConvertToInt(i interface{}, defaultValue int) int
- func ConvertToInt64(i interface{}, defaultValue int64) (ret int64)
- func ConvertToString(i interface{}, defaultValue string) (ret string)
- func CreateLogFile()
- func Decimal1(num float64) float64
- func Decimal2(num float64) float64
- func GetDate() string
- func GetDateByLocation(location *time.Location) string
- func GetDateHour() string
- func GetDateNum(location *time.Location) int
- func GetDateNum2(now *time.Time) int
- func GetDayEndTimeLocal() time.Time
- func GetDayEndTimeUtc() time.Time
- func GetLastHourToTs(ts int64) (lastHour int64)
- func GetMonthName(location *time.Location) int
- func GetMonthlyDayCount(year int, month int) int
- func GetNextDayStartTimeByLocation(location *time.Location) time.Time
- func GetNextDayStartTimeLocal() time.Time
- func GetNextDayStartTimeUtc() time.Time
- func GetSpecifiedNumToTs(ts int64, hour int64) (SpecifiedHour int64)
- func GetTimeByTz(tz string) (*time.Time, error)
- func GetTimeStampMs() string
- func GetTimeStampSec() string
- func GetWeekDay(location *time.Location) int32
- func GetWeekName(location *time.Location) int
- func In(target string, strList []string) bool
- func InitLogger()
- func Lcfirst(str string) string
- func MergeMaps(mObj ...map[string]interface{}) map[string]interface{}
- func MergeStrings(strs ...string) string
- func MkDir(dirPath string) error
- func PathExist(path string) error
- func PrintPerformTimeConsuming(funcName string, startTime time.Time)
- func SortSlice[T constraints.Ordered](s []T, reverse bool)
- func StringSub(str string, n int, reverse bool) string
- func StringSubA2B(str string, a int, b int, reverse bool) string
- func TimeName(t time.Time) string
- func Ucfirst(str string) string
- type BaseResponse
- type Buffer
- type MyInt
Constants ¶
This section is empty.
Variables ¶
var (
Glog = logrus.New()
)
Functions ¶
func ConvertByteToString ¶ added in v0.0.17
*
- @description: ConvertByteToString
- @param {[]byte} bytes
- @return {*}
- @author: liqiyuWorks
func ConvertCamelToCase ¶
*
- @description: 驼峰式写法转为下划线写法
- @param {string} name
- @return {*}
- @author: liqiyuWorks
func ConvertCamelToSlash ¶ added in v0.0.12
*
- @description: 把骆驼变成斜杠
- @param {string} name
- @return {*}
- @author: liqiyuWorks
func ConvertCaseToCamel ¶
*
- @description: 下划线写法转为驼峰写法
- @param {string} name
- @return {*}
- @author: liqiyuWorks
func ConvertInt64ToString ¶ added in v0.0.50
*
- @description: ConvertInt64ToString
- @param {int64} i
- @param {string} defaultValue
- @return {*}
- @author: liqiyuWorks
func ConvertJsonToMap ¶ added in v0.0.40
*
- @description: ConvertJsonToMap
- @param {string} stringData
- @param {*map[string]interface{}} mapData
- @return {*}
- @author: liqiyuWorks
func ConvertMapToJson ¶ added in v0.0.40
*
- @description: ConvertMapToJson
- @param {map[string]interface{}} mapData
- @return {*}
- @author: liqiyuWorks
func ConvertStringToByte ¶ added in v0.0.18
*
- @description: ConvertStringToByte
- @param {string} s
- @return {*}
- @author: liqiyuWorks
func ConvertStructToMap ¶
func ConvertStructToMap(i interface{}, defaultValue interface{}, ret interface{})
*
- @description: Struct转Map
- @param {interface{}} i
- @param {interface{}} defaultValue: nil
- @param {interface{}} ret
- @return {*}
- @author: liqiyuWorks
func ConvertToFloat64 ¶
*
- @description: interface转float64
- @param {interface{}} i
- @param {float64} defaultValue:0
- @return {*}
- @author: liqiyuWorks
func ConvertToInt ¶
*
- @description: interface转int
- @param {interface{}} i
- @param {int} defaultValue: 0
- @return {*}
- @author: liqiyuWorks
func ConvertToInt64 ¶
*
- @description: interface转int64
- @param {interface{}} i
- @param {int64} defaultValue:0
- @return {*}
- @author: liqiyuWorks
func ConvertToString ¶
*
- @description: interface转string
- @param {interface{}} i
- @param {string} defaultValue: ""
- @return {*}
- @author: liqiyuWorks
func CreateLogFile ¶
func CreateLogFile()
func GetDateByLocation ¶
func GetDateHour ¶
func GetDateHour() string
func GetDateNum ¶
func GetDateNum2 ¶
func GetDayEndTimeLocal ¶
func GetDayEndTimeUtc ¶
func GetLastHourToTs ¶
*
- @description: 计算最接近某小时的时间戳
- @param {int} ts
- @return {*}
- @author: liqiyuWorks
func GetMonthName ¶
func GetNextDayStartTimeUtc ¶
func GetSpecifiedNumToTs ¶ added in v0.0.16
*
- @description: 计算最接近n个小时的时间戳, 前后匹配,找到最接近的n小时的时刻
- @param {int64} ts
- @param {int64} hour
- @return {*}
- @author: liqiyuWorks
func GetTimeStampMs ¶
func GetTimeStampMs() string
func GetTimeStampSec ¶
func GetTimeStampSec() string
func GetWeekDay ¶
func GetWeekName ¶
func In ¶
*
- @description: 检查一个字符串是否存在于一个数组中
- @param {string} target
- @param {[]string} strList
- @return {*}
- @author: liqiyuWorks
func InitLogger ¶
func InitLogger()
func MergeMaps ¶
*
- @description: 合并maps
- @param {...map[string]interface{}} mObj
- @return {*}
- @author: liqiyuWorks
func SortSlice ¶ added in v0.0.46
func SortSlice[T constraints.Ordered](s []T, reverse bool)
*
- @description: 切片的排序,可逆序
- @return {*}
- @author: liqiyuWorks
func StringSub ¶
*
- @description: 截取字符串
- @param {string} str
- @param {int} n
- @param {bool} reverse: true: 反向切片, false: 正向切片
- @return {*}
- @author: liqiyuWorks
func StringSubA2B ¶ added in v0.0.22
*
- @description: StringSubA2B
- @param {string} str
- @param {int} a
- @param {int} b
- @param {bool} reverse fasle:正序 true 逆序
- @return {*}
- @author: liqiyuWorks