base

package
v3.0.8-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseAction

type BaseAction struct {
	CC *api.APIResource
}

BaseAction 所有Action 的基类

func (*BaseAction) CallResponse

func (cli *BaseAction) CallResponse(callfunc func() (string, error), resp *restful.Response)

CallResponse execute and deal with the response

func (*BaseAction) CallResponseEx

func (cli *BaseAction) CallResponseEx(callfunc func() (httpcode int, reply interface{}, err error), resp *restful.Response)

CallResponseEx execute and deal with the response

func (*BaseAction) CreateAction

func (cli *BaseAction) CreateAction() error

CreateAction 执行Action 初始化

func (*BaseAction) GetParams

func (cli *BaseAction) GetParams(cc *api.APIResource, keyvalues *map[string]string, key string, result interface{}, resp *restful.Response) error

GetParams parse the params

func (*BaseAction) IsSuccess

func (cli *BaseAction) IsSuccess(rst []byte) (*api.APIRsp, bool)

IsSuccess check the response

func (*BaseAction) Response

func (cli *BaseAction) Response(rst *api.APIRsp, resp *restful.Response)

Response execute the response

func (*BaseAction) ResponseFailed

func (cli *BaseAction) ResponseFailed(errno int, errmsg interface{}, resp *restful.Response)

ResponseFailed deal with the http code and response

func (*BaseAction) ResponseFailedEx

func (cli *BaseAction) ResponseFailedEx(httpcode int, errno int, errmsg interface{}, resp *restful.Response)

ResponseFailedEx deal with the http code and response

func (*BaseAction) ResponseFailedWithData

func (cli *BaseAction) ResponseFailedWithData(errno int, errmsg, data interface{}, resp *restful.Response)

ResponseFailedWithData deal with the failed response

func (*BaseAction) ResponseNative

func (cli *BaseAction) ResponseNative(datamsg string, resp *restful.Response)

ResponseNative return Native data

func (*BaseAction) ResponseRspString

func (cli *BaseAction) ResponseRspString(resp *restful.Response, data string, errno int, err string)

ResponseRspString parse the api.APIRsp struct

func (*BaseAction) ResponseSuccess

func (cli *BaseAction) ResponseSuccess(datamsg interface{}, resp *restful.Response)

ResponseSuccess deal with the success response

func (*BaseAction) ResponseSuccessData

func (cli *BaseAction) ResponseSuccessData(datamsg interface{}, resp *restful.Response) bool

ResponseSuccessData only response the success data

type BaseLogic

type BaseLogic struct {
	HttpCli *httpclient.HttpClient
}

BaseLogic logic 实现的基类

func (*BaseLogic) CreateHttpClient

func (cli *BaseLogic) CreateHttpClient() error

CreateHttpClient create the default http client and set the header

func (*BaseLogic) IsSuccess

func (cli *BaseLogic) IsSuccess(rst []byte) (*api.APIRsp, bool)

IsSuccess check the response

Jump to

Keyboard shortcuts

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