client

package
v0.0.0-...-eff0572 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PraseJsonArrayCommonHandle

func PraseJsonArrayCommonHandle(body BodyType) (dataMap []any, err error)

Types

type BodyHandle

type BodyHandle func(BodyType) (body BodyType, err error)

type BodyType

type BodyType = []byte

type DataMapArrayHandle

type DataMapArrayHandle func([]any) ([]any, error)

type DataMapHandle

type DataMapHandle func(any) ([]any, error)

type DataMapType

type DataMapType = map[string]interface{}

func PraseJsonCommonHandle

func PraseJsonCommonHandle(body BodyType) (dataMap DataMapType, err error)

type FastClient

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

func NewFastClient

func NewFastClient(url string) (f *FastClient)

func (*FastClient) BodyHandle

func (f *FastClient) BodyHandle(callback func(BodyType) (BodyType, error)) error

func (*FastClient) DataMapArrayHandle

func (f *FastClient) DataMapArrayHandle(callback DataMapArrayHandle) ([]any, error)

func (*FastClient) DataMapHandle

func (f *FastClient) DataMapHandle(callback DataMapHandle) ([]any, error)

func (*FastClient) GetBody

func (f *FastClient) GetBody() BodyType

func (*FastClient) GetJsonArrayDo

func (f *FastClient) GetJsonArrayDo(bodyHandle BodyHandle,
	dataMapArrayHandle DataMapArrayHandle) (result []any, err error)

func (*FastClient) GetJsonDo

func (f *FastClient) GetJsonDo(bodyHandle BodyHandle,
	dataMapHandle DataMapHandle) (result []any, err error)

func (*FastClient) GetTimeout

func (f *FastClient) GetTimeout() time.Duration

func (*FastClient) GetUrl

func (f *FastClient) GetUrl() string

func (*FastClient) PostJsonArrayDo

func (f *FastClient) PostJsonArrayDo(
	jsonBody string,
	bodyHandle BodyHandle,
	dataMapArrayHandle DataMapArrayHandle) (result []any, err error)

func (*FastClient) PostJsonDo

func (f *FastClient) PostJsonDo(
	jsonBody string,
	bodyHandle BodyHandle,
	dataMapHandle DataMapHandle) (result []any, err error)

func (*FastClient) PraseJsonArrayHandle

func (f *FastClient) PraseJsonArrayHandle(callback func(BodyType) ([]any, error)) error

func (*FastClient) PraseJsonHandle

func (f *FastClient) PraseJsonHandle(callback func(BodyType) (DataMapType, error)) error

func (*FastClient) RequestGet

func (f *FastClient) RequestGet() error

func (*FastClient) RequestPostForm

func (f *FastClient) RequestPostForm(formBody string) error

func (*FastClient) RequestPostJson

func (f *FastClient) RequestPostJson(jsonBody string) error

func (*FastClient) SetBody

func (f *FastClient) SetBody(body BodyType)

func (*FastClient) SetCookie

func (f *FastClient) SetCookie(key, value string)

func (*FastClient) SetHeadReq

func (f *FastClient) SetHeadReq(key, value string)

func (*FastClient) SetHeadResp

func (f *FastClient) SetHeadResp(key, value string)

func (*FastClient) SetTimeout

func (f *FastClient) SetTimeout(timeout time.Duration)

func (*FastClient) SetUrl

func (f *FastClient) SetUrl(url string)

func (*FastClient) SetUserAgent

func (f *FastClient) SetUserAgent(value string)

type ResJson

type ResJson struct {
	Msg  string `json:"msg"`
	Code int    `json:"code"`
	Data any    `json:"data"`
}

type ResJsonArray

type ResJsonArray struct {
	Msg  string `json:"msg"`
	Code int    `json:"code"`
	Data []any  `json:"data"`
}

Jump to

Keyboard shortcuts

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