tools

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 44

README

tools

go的工具集

安装

go get github.com/PeterYangs/tools

Documentation

Index

Constants

View Source
const HttpTimeOut = 10 * time.Second

超时时间

Variables

This section is empty.

Functions

func Date added in v0.0.6

func Date(format string, timestamp int64) string

先用比较蠢的办法

func DeleteFile

func DeleteFile(path string) error

func DownloadFile

func DownloadFile(url string, path string) error

下载文件

func DownloadImage added in v0.0.3

func DownloadImage(url string, path string) error

图片下载

func Explode added in v0.0.4

func Explode(delimiter, text string) []string

func GetSetHeaderWithString

func GetSetHeaderWithString(url string, header map[string]string) (string, error)

* header["Accept-Encoding"]="gzip, deflate, br"

func GetWithBody

func GetWithBody(url string) (io.ReadCloser, error)

注意要手动关闭body

func GetWithResp added in v0.0.3

func GetWithResp(url string) (*http.Response, error)

注意要手动关闭body

func GetWithString

func GetWithString(url string) (string, error)

get获取字符串结果

func In_array added in v0.0.8

func In_array(array interface{}, item interface{}) bool

func Md5 added in v0.0.4

func Md5(str string) string

func Query

func Query(url string, method string, parameter string, header map[string]string) (*http.Response, error)

请求底层函数

func ReadFile

func ReadFile(path string) (string, error)

读取文件

func SendEmail added in v0.0.5

func SendEmail(from string, to []string, title string, content string, host string, port int, password string) error

发送邮件

func StrToTime added in v0.0.6

func StrToTime(str string) int64

func WriteLine

func WriteLine(path string, data string)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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