api

package
v0.0.0-...-5870b03 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(httpCtxIn *hfw.HTTPContext, header map[string]string, addressParams interface{}, uri string, p interface{}, resp interface{}, opts ...CallOption) (err error)

用于任意返回json数据的http服务

func Download

func Download(httpCtx *hfw.HTTPContext, url string, p interface{}) (content []byte, err error)

func RequestUnmarshal

func RequestUnmarshal(httpCtx *hfw.HTTPContext, params interface{}) (err error)

RequestUnmarshal 从httpCtx里解析数据到params

func StdCall

func StdCall(httpCtx *hfw.HTTPContext, addressParams interface{}, uri string, p interface{}, results interface{}, opts ...CallOption) (err error)

用于调用内部的其他标准http服务 标准的http服务是指response里包含err_no、err_msg和results

func StdCallByConsul

func StdCallByConsul(httpCtx *hfw.HTTPContext, serviceName, uri string, p interface{}, results interface{}, opts ...CallOption) (err error)

用于调用内部的其他标准http服务 标准的http服务是指response里包含err_no、err_msg和results

Types

type AddHeadersCallOption

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

func (AddHeadersCallOption) Do

type CallOption

type CallOption interface {
	Do(*curl.Curl) error
}

func NewAddHeadersCallOption

func NewAddHeadersCallOption(headers map[string]string) CallOption

func NewDelHeadersCallOption

func NewDelHeadersCallOption(keys ...string) CallOption

func NewTimeOutCallOption

func NewTimeOutCallOption(timeout int) CallOption

type DelHeadersCallOption

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

func (DelHeadersCallOption) Do

type Response

type Response struct {
	ErrNo   int64       `json:"err_no"`
	ErrMsg  string      `json:"err_msg"`
	Results interface{} `json:"results"`
}

内部第三方接口返回

type TimeOutCallOption

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

func (TimeOutCallOption) Do

func (t TimeOutCallOption) Do(c *curl.Curl) error

Jump to

Keyboard shortcuts

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