tool

package module
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 20 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cookie cookie
View Source
var File file
View Source
var Regexp reg
View Source
var Time timE

Functions

func GenHttpClient added in v0.6.4

func GenHttpClient(opt *HttpClientOptions) *http.Client

func Recover added in v0.6.2

func Recover() any

Types

type DoHttpReq added in v0.6.4

type DoHttpReq struct {
	Url    string
	Header map[string]interface{}
	Query  map[string]interface{}
	Body   interface{}
	Cookie map[string]string
}

type Http added in v0.6.4

type Http struct {
	Client *http.Client
}

func NewHttpTool added in v0.6.4

func NewHttpTool(c *http.Client) *Http

func (*Http) GenReq added in v0.6.4

func (a *Http) GenReq(Type string, opt *DoHttpReq) (*http.Request, error)

func (*Http) Get added in v0.6.4

func (a *Http) Get(opt *DoHttpReq) (*http.Response, map[string]interface{}, error)

Get 表单请求快捷方式

func (*Http) GetBytes added in v0.6.4

func (a *Http) GetBytes(opt *DoHttpReq) (*http.Response, []byte, error)

func (*Http) GetRequest added in v0.6.4

func (a *Http) GetRequest(opt *DoHttpReq) (*http.Response, error)

func (*Http) GetString added in v0.6.4

func (a *Http) GetString(opt *DoHttpReq) (*http.Response, string, error)

func (*Http) Post added in v0.6.4

func (a *Http) Post(opt *DoHttpReq) (*http.Response, map[string]interface{}, error)

Post 表单请求快捷方式

func (*Http) PostBytes added in v0.6.4

func (a *Http) PostBytes(opt *DoHttpReq) (*http.Response, []byte, error)

func (*Http) PostRequest added in v0.6.4

func (a *Http) PostRequest(opt *DoHttpReq) (*http.Response, error)

func (*Http) PostString added in v0.6.4

func (a *Http) PostString(opt *DoHttpReq) (*http.Response, string, error)

func (*Http) PrepareRequest added in v0.6.4

func (a *Http) PrepareRequest(Type string, opt *DoHttpReq) (*HttpRequest, error)

func (*Http) ReadResBodyToByte added in v0.6.4

func (*Http) ReadResBodyToByte(i io.ReadCloser) ([]byte, error)

func (*Http) ReadResBodyToString added in v0.6.4

func (a *Http) ReadResBodyToString(i io.ReadCloser) (string, error)

func (*Http) Request added in v0.6.4

func (a *Http) Request(Type string, opt *DoHttpReq) (*http.Response, error)

func (*Http) UnMarshalResBodyToMap added in v0.6.4

func (a *Http) UnMarshalResBodyToMap(i io.ReadCloser) (map[string]interface{}, error)

type HttpClientOptions added in v0.6.4

type HttpClientOptions struct {
	Transport *http.Transport
	//禁止跟随重定向
	NoRedirect bool
	//启用 cookiejar
	RedirectCookieJar bool
	//超时时间
	Timeout time.Duration
}

type HttpRequest added in v0.6.4

type HttpRequest struct {
	Req *http.Request
	// contains filtered or unexported fields
}

func (*HttpRequest) Do added in v0.6.4

func (a *HttpRequest) Do() (*http.Response, error)

type RandCryptoLetters added in v0.7.7

type RandCryptoLetters struct {
	// contains filtered or unexported fields
}

func RandCrypto added in v0.7.7

func RandCrypto(letters string) (r RandCryptoLetters)

func (RandCryptoLetters) Text added in v0.7.8

func (r RandCryptoLetters) Text(Len int) ([]byte, error)

type RandMathNum added in v0.7.7

type RandMathNum struct {
	// contains filtered or unexported fields
}

func RandMath added in v0.7.7

func RandMath(src rand.Source) RandMathNum

func (RandMathNum) Num added in v0.7.7

func (r RandMathNum) Num(Min, Max int) int

Num [min,max]

func (RandMathNum) WithLetters added in v0.7.7

func (r RandMathNum) WithLetters(letters string) RandMathWithLetters

type RandMathWithLetters added in v0.7.7

type RandMathWithLetters struct {
	RandMathNum
	// contains filtered or unexported fields
}

func (RandMathWithLetters) Text added in v0.7.8

func (r RandMathWithLetters) Text(Len int) []byte

Jump to

Keyboard shortcuts

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