basethird

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body string

func (Body) Value added in v1.2.2

func (b Body) Value() io.Reader

type HttpThird

type HttpThird struct {
	Domain           string
	Hostname         string
	ConnectTimeout   int
	ReadWriteTimeout int
	// contains filtered or unexported fields
}

封装 http 接口的基础类

func (*HttpThird) Delete

func (a *HttpThird) Delete(api string, params map[string]interface{}) (*Response, error)

func (*HttpThird) Get

func (a *HttpThird) Get(api string, params map[string]interface{}) (*Response, error)

func (*HttpThird) Head

func (a *HttpThird) Head(api string, params map[string]interface{}) (*Response, error)

func (*HttpThird) Post

func (a *HttpThird) Post(api string, params map[string]interface{}) (*Response, error)

func (*HttpThird) Put

func (a *HttpThird) Put(api string, params map[string]interface{}) (*Response, error)

func (*HttpThird) SetBaseAuth

func (a *HttpThird) SetBaseAuth(username, password string)

func (*HttpThird) SetHeader

func (a *HttpThird) SetHeader(headers map[string]string)

func (*HttpThird) SetLogInfoFlag

func (a *HttpThird) SetLogInfoFlag(on bool)

设置是否要关闭 info 日志

func (*HttpThird) SetTLSClientConfig added in v1.2.2

func (a *HttpThird) SetTLSClientConfig(cfg *tls.Config)

type PostFile

type PostFile string

func (PostFile) Value added in v1.2.2

func (p PostFile) Value(name string) (f grequests.FileUpload, e error)

type Response added in v1.2.2

type Response struct {
	*grequests.Response
}

func (*Response) JSON added in v1.2.2

func (r *Response) JSON(v interface{}) error

func (*Response) String added in v1.2.2

func (r *Response) String() (string, error)

func (*Response) ToJSON added in v1.2.2

func (r *Response) ToJSON(v interface{}) error

rewrite ToJSON then you can use ToJSON many times

type RpcThird

type RpcThird struct {
	sync.Mutex
	Address          string
	Timeout          int
	MaxRecvMsgsizeMb int
	MaxSendMsgsizeMb int
	SslOn            bool
	CertFile         string
	Hostname         string
	// contains filtered or unexported fields
}

封装 rpc 的基础类

func (*RpcThird) Call

func (a *RpcThird) Call(f func(conn *grpc.ClientConn, ctx context.Context) (proto.Message, error), params interface{}) (proto.Message, error)

func (*RpcThird) GetConn

func (a *RpcThird) GetConn() (*grpc.ClientConn, error)

@todo reconnect

func (*RpcThird) GetCtx

func (a *RpcThird) GetCtx() (context.Context, context.CancelFunc)

Jump to

Keyboard shortcuts

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