zrpc

package
v1.0.80 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewForm

func NewForm(v interface{}) url2.Values

请求表单(适用于GET参数、POST表单等)

Types

type Client

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

HTTP客户端

func New

func New(name string, retry int, timeout time.Duration, logger *log.Logger, opts ...Option) *Client

创建HTTP客户端

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string, params url2.Values, response interface{}, opts ...Option) (data []byte, code int, err error)

GET请求

func (*Client) PostForm

func (c *Client) PostForm(ctx context.Context, url string, values url2.Values, response interface{}, opts ...Option) (data []byte, code int, err error)

POST表单请求

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, url string, request, response interface{}, opts ...Option) (data []byte, code int, err error)

POST JSON请求

type Option

type Option func(ctx context.Context, req *Request)

HTTP请求选项

type Request

type Request http.Request

HTTP请求

type Response

type Response struct {
	Errno   int             `json:"errno"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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