result

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthHttpResult

func AuthHttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err error)

授权的http方法

func HttpResult

func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err error)

http返回

func JobResult

func JobResult(ctx context.Context, resp interface{}, err error)

job返回

func NewCodeError

func NewCodeError(code int, msg string) error

func NewDefaultError

func NewDefaultError(msg string) error

func ParamErrorResult

func ParamErrorResult(r *http.Request, w http.ResponseWriter, err error)

http 参数错误返回

Types

type Body

type Body struct {
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data,omitempty"`
	TraceID string      `json:"traceId,omitempty"`
}

type CodeError

type CodeError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func (*CodeError) Data

func (e *CodeError) Data() *CodeErrorResponse

func (*CodeError) Error

func (e *CodeError) Error() string

type CodeErrorResponse

type CodeErrorResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type NullJson

type NullJson struct{}

type ResponseErrorBean

type ResponseErrorBean struct {
	Code    uint32 `json:"code"`
	Msg     string `json:"msg"`
	TraceID string `json:"traceId,omitempty"`
}

func Error

func Error(errCode uint32, errMsg string, ctx context.Context) *ResponseErrorBean

type ResponseSuccessBean

type ResponseSuccessBean struct {
	Code    uint32      `json:"code"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
	TraceID string      `json:"traceId,omitempty"`
}

func Success

func Success(data interface{}, ctx context.Context) *ResponseSuccessBean

Jump to

Keyboard shortcuts

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