utils

package
v0.0.0-...-d62a2a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(i interface{}) bool

Bool @description: 转换为bool类型 @param: @author: GJing @email: gjing1st@gmail.com @date: 2022/12/27 14:40 @success:

func DiffNatureDays

func DiffNatureDays(t1, t2 int64) int

DiffNatureDays @description: 两个日期的相差的自然天数 @param: @author: GJing @email: gjing1st@gmail.com @date: 2022/11/16 11:22 @success:

func Div

func Div(Num int) string

Div 数字转字母

func DockerRunCommand

func DockerRunCommand(command string) (err error)

DockerRunCommand @description: docker容器执行宿主机指令 @param: @author: GJing @email: gjing1st@gmail.com @date: 2023/2/11 13:46 @success:

func Float64

func Float64(any interface{}) float64

Float64 @description: 接口类型转float64 @param: any 接口类型 @author: GJing @email: guojing@tna.cn @date: 2022/4/22 10:44 @success: float64

func InArray

func InArray(value string, arr []string) bool

InArray @description: 判断一个字符串是否在数组中 @param: @author: GJing @email: gjing1st@gmail.com @date: 2020/11/13 14:42 @success:

func Int

func Int(any interface{}) int

Int @description: 转int @param: @author: GJing @email: guojing@tna.cn @date: 2022/4/22 11:13 @success:

func Int64

func Int64(any interface{}) int64

Int64 @description: 接口类型转int64 @param: any 接口类型 @author: GJing @email: guojing@tna.cn @date: 2022/4/22 10:56 @success: int64

func LeDecodeToFloat64

func LeDecodeToFloat64(b []byte) float64

func LeFillUpSize

func LeFillUpSize(b []byte, l int) []byte

func LogField

func LogField(err error, msg string) log.Fields

LogField @description: 日志字段 @param: @author: GJing @email: gjing1st@gmail.com @date: 2022/11/1 15:35 @success:

func Md5

func Md5(str string) string

Md5 Author: GJing Email: gjing1st@gmail.com Date: 2020/10/23 13:57 Description: md5加密

func PathExists

func PathExists(path string) (bool, error)

PathExists @description: 判断文件是否存在 @param: @author: Zq @email: zhengqiang@tna.cn @date: 2022/10/19 17:52 @success:

func ReserveNumber

func ReserveNumber(f float64, m int) string

ReserveNumber @description: 截取保留小数点后m位,舍去后面位数 @param: f float64 @param: m 保留的位数 @author: GJing @email: gjing1st@gmail.com @date: 2020/11/25 上午 10:31 @success: 返回截取后的字符串

func Round

func Round(f float64, n int) float64

Round @description: 四舍五入保留n位小数 @param:f 需要处理的float数 @param:n 需要保留的小数位数 @author: GJing @email: gjing1st@gmail.com @date: 2021/1/23 10:36 @success:

func RunCommand

func RunCommand(name string, arg ...string) (err error)

RunCommand @description: 运行系统命令 @param: cmdStr 要运行的命令 @author: GJing @email: guojing@tna.cn @date: 2022/9/2 17:46 @success:

func String

func String(any interface{}) string

String @description: 转string类型 @param: any 接口类型 @author: GJing @email: guojing@tna.cn @date: 2022/4/22 11:11 @success: 字符串

func UnExt

func UnExt(fileName string) string

UnExt @description: 返回文件名称去掉后缀和最后一个`.` @param: fileName 文件名称 @author: GJing @email: guojing@tna.cn @date: 2022/7/28 15:39 @success:

func UnzipDir

func UnzipDir(zipFile, dir string)

UnzipDir @description: 解压缩 @param:zipFile 压缩文件路径 ./test.zip @param:dir 需要解压到的指定文件夹目录 ex :F:\dumps_copy @author: GJing @email: gjing1st@gmail.com @date: 2021/1/13 15:19 @success:

func VersionCompare

func VersionCompare(v1, v2 string) (res bool)

VersionCompare @description: 版本比较,v2版本是否大于v1版本 @param: v1 string 当前版本 @param: v2 string 最新版本 @author: GJing @email: gjing1st@gmail.com @date: 2023/2/16 14:41 @success: v2>v1返回true

func WriteFile

func WriteFile(fileName, s string) (err error)

WriteFile @description: @param: @author: GJing @email: guojing@tna.cn @date: 2022/9/2 17:52 @success:

Types

type Host

type Host struct {
	IP       string
	Password string
	User     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL