rpc

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequestURL = errors.New("invalid request url")
	UserAgent            = ""
)

Functions

func CallRet

func CallRet(_ Context, ret interface{}, resp *http.Response) (err error)

func NewRequest

func NewRequest(method, url1 string, body io.Reader) (req *http.Request, err error)

func ResponseError

func ResponseError(resp *http.Response) (err error)

Types

type Client

type Client struct {
	*http.Client
}

func (Client) Call

func (r Client) Call(
	ctx Context, ret interface{}, method, url1 string) (err error)

func (Client) CallWith

func (r Client) CallWith(
	ctx Context, ret interface{}, method, url1, bodyType string, body io.Reader, bodyLength int) (err error)

func (Client) CallWith64

func (r Client) CallWith64(
	ctx Context, ret interface{}, method, url1, bodyType string, body io.Reader, bodyLength int64, timeout time.Duration) (err error)

func (Client) CallWithForm

func (r Client) CallWithForm(
	ctx Context, ret interface{}, method, url1 string, param map[string][]string, timeout time.Duration) (err error)

func (Client) CallWithJson

func (r Client) CallWithJson(
	ctx Context, ret interface{}, method, url1 string, param interface{}) (err error)

func (Client) CallWithJsonWithTimeout

func (r Client) CallWithJsonWithTimeout(
	ctx Context, ret interface{}, method, url1 string, param interface{}, timeout time.Duration) (err error)

func (Client) CallWithTimeout

func (r Client) CallWithTimeout(
	ctx Context, ret interface{}, method, url1 string, timeout time.Duration) (err error)

func (Client) CallWithWithTimeout

func (r Client) CallWithWithTimeout(
	ctx Context, ret interface{}, method, url1, bodyType string, body io.Reader, bodyLength int, timeout time.Duration) (err error)

func (Client) Do

func (r Client) Do(ctx Context, req *http.Request) (resp *http.Response, err error)

func (Client) DoRequest

func (r Client) DoRequest(ctx Context, method, url string, timeout time.Duration) (resp *http.Response, err error)

func (Client) DoRequestWith

func (r Client) DoRequestWith(
	ctx Context, method, url1 string,
	bodyType string, body io.Reader, bodyLength int,
	timeout time.Duration,
) (resp *http.Response, err error)

func (Client) DoRequestWith64

func (r Client) DoRequestWith64(
	ctx Context, method, url1 string,
	bodyType string, body io.Reader, bodyLength int64,
	timeout time.Duration,
) (resp *http.Response, err error)

func (Client) DoRequestWithForm

func (r Client) DoRequestWithForm(
	ctx Context, method, url1 string, data map[string][]string,
	timeout time.Duration,
) (resp *http.Response, err error)

func (Client) DoRequestWithJson

func (r Client) DoRequestWithJson(
	ctx Context, method, url1 string, data interface{}, timeout time.Duration) (resp *http.Response, err error)

func (Client) DoWithTimeout

func (r Client) DoWithTimeout(ctx Context, req *http.Request, timeout time.Duration) (resp *http.Response, err error)

type ErrorInfo

type ErrorInfo struct {
	Err   string `json:"error,omitempty"`
	Key   string `json:"key,omitempty"`
	Reqid string `json:"reqid,omitempty"`
	Errno int    `json:"errno,omitempty"`
	Code  int    `json:"code"`
}

func (*ErrorInfo) Error

func (r *ErrorInfo) Error() string

func (*ErrorInfo) ErrorDetail

func (r *ErrorInfo) ErrorDetail() string

func (*ErrorInfo) HttpCode

func (r *ErrorInfo) HttpCode() int

func (*ErrorInfo) RpcError

func (r *ErrorInfo) RpcError() (code, errno int, key, err string)

Jump to

Keyboard shortcuts

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