utils

package
v0.0.0-...-07ef6c8 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Artistic-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LOC, _ = time.LoadLocation("Asia/Shanghai")
View Source
var StantardTimeFormat = "2006-01-02 15:04:05"

Functions

func BytetoH

func BytetoH(b []byte) string

字节数组转16进制可以直接使用 fmt自带的

func ComputeDates

func ComputeDates(startDate, endDate string) []string

func ComputeDatesWithTemplate

func ComputeDatesWithTemplate(startDate, endDate string, timeTemplate string) []string

timeTemplate可以自己指定//timeTemplate := "2006-01-02"

func DateStringToInt64

func DateStringToInt64(dateString string) int64

func DingdingLinkAlert

func DingdingLinkAlert(url string, title string, content string) ([]byte, error)

func DingdingMarkdownAlert

func DingdingMarkdownAlert(url string, title string, content string, phones string) ([]byte, error)

func DingdingTextAlert

func DingdingTextAlert(url string, title string, content string) ([]byte, error)

func ExecShellCommon

func ExecShellCommon(commandString string) (string, error)

func ExecShellProcessed

func ExecShellProcessed(commandString string) error

func ExecShellProcessedWithPath

func ExecShellProcessedWithPath(commandString string, path string) error

func FormatStandardTime

func FormatStandardTime(t1 time.Time) string

func GetDatePlus

func GetDatePlus(originalDate string, days int) (bool, string)

根据传入的日期,选择+3天

func GetDatePlusWithHyphen

func GetDatePlusWithHyphen(originalDate string, days int) (bool, string)

根据传入的日期,选择+3天

func GetDatePlusWithHyphenOriginalHyphen

func GetDatePlusWithHyphenOriginalHyphen(originalDate string, days int) (bool, string)

func GetDeploymentVersion

func GetDeploymentVersion(namespace string, projectName string) ([]string, error)

func GetIpDest

func GetIpDest(ip string) (string, error)

func GetIpFromCipCc

func GetIpFromCipCc(ip string) string

func GetIpSlice

func GetIpSlice(ipSection string) ([]string, error)

func GetPrivateIp

func GetPrivateIp() string

func Hextob

func Hextob(str string) []byte

16进制数到byte数组

func HyphenVersion

func HyphenVersion(version string) string

func Ip2Hex

func Ip2Hex(ip string) int

IP端口192.168.1.192转化为10进制数字,方便做排序

func IpPort2Hex

func IpPort2Hex(ipAddr string) int

IP端口192.168.1.192:5044转化为10进制数字211827816469428,方便做排序

func IsIp

func IsIp(ip string) (b bool)

func K8sApply

func K8sApply(namespace string, yamlFile string) (string, error)

func K8sDeleteDeployment

func K8sDeleteDeployment(namespace string, deploymentName string) (string, error)

func MinuteStringToInt64

func MinuteStringToInt64(dateString string) int64

func RandString

func RandString(n int) string

func RandomPhoneNumber

func RandomPhoneNumber() int64

func ReadLine

func ReadLine(fileName string) ([]string, error)

func ReadYamlConfig

func ReadYamlConfig(file string) []byte

func SimpleTimeSectionStringFor91160

func SimpleTimeSectionStringFor91160(input int64) string

func SliceMax

func SliceMax(s ...int) int

func SliceMin

func SliceMin(s ...int) int

func SplitFileName

func SplitFileName(filename string) (string, string, error)

func SplitFilePath

func SplitFilePath(filepath string) (string, string, string, error)

func SplitLogGzName

func SplitLogGzName(filename string) (string, string, error)

/

func SplitLogGzPath

func SplitLogGzPath(filepath string) (string, string, string, error)

func StringSliceHas

func StringSliceHas(s []string, a string) bool

func StringWithMillisToInt64

func StringWithMillisToInt64(dateString string) int64

代号秒的时间转换

func SubDays

func SubDays(date1, date2 string) (bool, int)

func SubDaysWithHyphen

func SubDaysWithHyphen(date1, date2 string) (bool, int)

func SubDaysWithTemplate

func SubDaysWithTemplate(date1, date2 string, template string) (bool, int)

func TimeIn64ToString

func TimeIn64ToString(input int64) string

func TimeIn64ToStringCsvCompatible

func TimeIn64ToStringCsvCompatible(input int64) string

func TimeIn64ToStringFor91160

func TimeIn64ToStringFor91160(input int64) string

func TimePath

func TimePath(t time.Time) (string, string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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