util

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GClient *http.Client

Functions

func ByteToFloat64 added in v1.0.2

func ByteToFloat64(bytes []byte) float64

func BytesToInt added in v1.0.2

func BytesToInt(b []byte) int

func ChkError added in v1.1.1

func ChkError(err error)

func Contains added in v1.1.0

func Contains(all string, substr string) bool

func DateBeforeFormat added in v1.1.0

func DateBeforeFormat(day int) string

获取n天前时间并格式化

func DateFormat added in v1.1.0

func DateFormat(timestamp int, formatString string) string

时间戳转年月日

func DateFormatYmd added in v1.1.0

func DateFormatYmd(timestamp int) string

时间戳转年月日

func DateSelfBeforeFormat added in v1.1.0

func DateSelfBeforeFormat(day int, date string) string

根据定义时间往前推

func DateUnix added in v1.1.0

func DateUnix() int

时间戳

func DatetimeToMilliSecond added in v1.1.2

func DatetimeToMilliSecond(datetime string) int64

DatetimeToMilliSecond 日期时间格式转换成毫秒

func FileExist added in v1.1.0

func FileExist(fileName string) bool

func Float32ToStr added in v1.1.0

func Float32ToStr(num float32) string

func Float64ToStr added in v1.1.0

func Float64ToStr(num float64) string

func FloatRound added in v1.1.0

func FloatRound(f float64, n int) float64

func GenerateFile added in v1.1.1

func GenerateFile(fileName string, str string)

func GetExecutePath

func GetExecutePath() string

获取当前运行文件目录

func GetFormatDateNow added in v1.1.0

func GetFormatDateNow(formatString string) string

"2006-01-02 15:04:05"

func GetText added in v1.1.0

func GetText(str string) string

func HttpGet added in v1.1.0

func HttpGet(url string, timeout int, cookiestr string) []byte

get

func HttpGetCookie added in v1.1.0

func HttpGetCookie(url string, cookiestr string, timeout int) []byte

func HttpGetProxy added in v1.1.0

func HttpGetProxy(client *http.Client, url string, cookiestr string) []byte

func HttpPost added in v1.1.0

func HttpPost(url string, data url.Values, timeout int) []byte

生成client 通过client的Do方法执行

func HttpPostError added in v1.1.1

func HttpPostError(url string, data url.Values, timeout int) ([]byte, error)

生成client 通过client的Do方法执行

func HttpPostJson added in v1.1.1

func HttpPostJson(url string, data []byte, timeout int) []byte

生成client 通过client的Do方法执行

func Int64ToStr added in v1.1.0

func Int64ToStr(num int64) string

func IntToStr added in v1.1.0

func IntToStr(str int) string

func Interface2Float64 added in v1.0.2

func Interface2Float64(inter interface{}) float64

func Interface2Int added in v1.0.2

func Interface2Int(inter interface{}) int

func Interface2String added in v1.0.2

func Interface2String(inter interface{}) string

func JsonDecode

func JsonDecode(data []byte, v interface{}) error

func JsonEncode

func JsonEncode(v interface{}) ([]byte, error)

func MathDecimal2

func MathDecimal2(value float64) float64

浮点保留2位小数

func PrintType

func PrintType(s interface{})

打印值和类型

func PrintVal

func PrintVal(s interface{})

打印值

func ReadFile added in v1.1.0

func ReadFile(fileName string) (contents []string)

func ReadFileString added in v1.1.1

func ReadFileString(fileName string) (contents string)

func ReadLine added in v1.1.0

func ReadLine(filename string, chanr chan string)

逐行读取

func StrToInt added in v1.1.0

func StrToInt(str string) int

func StrToInt64 added in v1.1.0

func StrToInt64(str string) int64

func TransLocal added in v1.1.1

func TransLocal(utcTime string, format string) string

func Trims added in v1.1.1

func Trims(str string) string

func UTCTransLocal added in v1.1.1

func UTCTransLocal(utcTime string, format string) string

func WriteFile added in v1.1.0

func WriteFile(filename string, msg string)

func WriteFileCustom added in v1.1.0

func WriteFileCustom(filename string, msg string, optype string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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