Documentation
¶
Index ¶
- func Convert2LogString(object interface{}) string
- func Get(ctx context.Context, params *HttpRequestParams) ([]byte, error)
- func LogRpcJson(ctx context.Context, business string, method string, params interface{}, ...)
- func SendRequest(ctx context.Context, client *http.Client, httpRequestParams *HttpRequestParams, ...) (result []byte, err error)
- func SendRequestOriResp(ctx context.Context, client *http.Client, httpRequestParams *HttpRequestParams, ...) (result *http.Response, err error)
- type HttpClient
- func (c HttpClient) Delete(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
- func (c HttpClient) Get(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
- func (c HttpClient) LoadType() string
- func (c HttpClient) PostFile(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
- func (c HttpClient) PostForm(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
- func (c HttpClient) PostJson(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
- func (c HttpClient) PostJsonOriResp(ctx context.Context, httpRequestParams *HttpRequestParams) (result *http.Response, err error)
- func (c HttpClient) Stop() error
- type HttpRequestFileParams
- type HttpRequestParams
- type LogLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert2LogString ¶ added in v0.1.5
func Convert2LogString(object interface{}) string
func LogRpcJson ¶ added in v0.1.5
func SendRequest ¶
func SendRequest(ctx context.Context, client *http.Client, httpRequestParams *HttpRequestParams, requestType string, buildRequest func(*HttpRequestParams, context.Context) (*http.Request, string, error)) (result []byte, err error)
SendRequest 此方法实现的目的是作为一个通用的http调用方法,也是最核心http调用
func SendRequestOriResp ¶
func SendRequestOriResp(ctx context.Context, client *http.Client, httpRequestParams *HttpRequestParams, requestType string, buildRequest func(*HttpRequestParams, context.Context) (*http.Request, string, error)) (result *http.Response, err error)
SendRequestOriResp 此方法实现的目的是作为一个通用的http调用方法,也是最核心http调用
Types ¶
type HttpClient ¶
func GetClient ¶
func GetClient() HttpClient
func (HttpClient) Delete ¶
func (c HttpClient) Delete(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
Delete 删除数据
func (HttpClient) Get ¶
func (c HttpClient) Get(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
func (HttpClient) LoadType ¶
func (c HttpClient) LoadType() string
func (HttpClient) PostFile ¶
func (c HttpClient) PostFile(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
PostFile 如果想传递其他参数,则通过params传递
func (HttpClient) PostForm ¶
func (c HttpClient) PostForm(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
func (HttpClient) PostJson ¶
func (c HttpClient) PostJson(ctx context.Context, httpRequestParams *HttpRequestParams) (result []byte, err error)
func (HttpClient) PostJsonOriResp ¶
func (c HttpClient) PostJsonOriResp(ctx context.Context, httpRequestParams *HttpRequestParams) (result *http.Response, err error)
PostJsonOriResp 此方法需要在外部设置content 超时,并进行defer cancel
func (HttpClient) Stop ¶
func (c HttpClient) Stop() error
type HttpRequestFileParams ¶
type HttpRequestParams ¶
Click to show internal directories.
Click to hide internal directories.