result

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MulanPSL-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 added in v0.1.14

func NewCodeError(code int, msg string) error

func NewDefaultError added in v0.1.14

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 added in v0.1.14

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

func (*CodeError) Data added in v0.1.14

func (e *CodeError) Data() *CodeErrorResponse

func (*CodeError) Error added in v0.1.14

func (e *CodeError) Error() string

type CodeErrorResponse added in v0.1.14

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