response

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: MIT Imports: 3 Imported by: 0

README

Build Status Codecov GoDoc Go Report Card License

response

  • gin context.JSON wrapper
  • echo context.JSON wrapper

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EchoQuickResp

type EchoQuickResp struct {
}

EchoQuickResp echo quick response

func (*EchoQuickResp) Resp

func (e *EchoQuickResp) Resp(ctx echo.Context, code int, resp Response) error

Resp consume resp body

func (*EchoQuickResp) RespBadRequest

func (e *EchoQuickResp) RespBadRequest(ctx echo.Context, errmsg ...string) error

RespBadRequest means the client param error

func (*EchoQuickResp) RespData

func (e *EchoQuickResp) RespData(ctx echo.Context, data interface{}, errmsg ...string) error

RespData data response

func (*EchoQuickResp) RespFail

func (e *EchoQuickResp) RespFail(ctx echo.Context, errmsg ...string) error

RespFail business fail code

func (*EchoQuickResp) RespNotFound

func (e *EchoQuickResp) RespNotFound(ctx echo.Context, errmsg ...string) error

RespNotFound means resource not found

func (*EchoQuickResp) RespOk

func (e *EchoQuickResp) RespOk(ctx echo.Context, errmsg ...string) error

RespOk response mean's ok

type EchoResponse

type EchoResponse interface {
	RespOk(ctx echo.Context, errmsg ...string) error
	RespBadRequest(ctx echo.Context, errmsg ...string) error
	RespNotFound(ctx echo.Context, errmsg ...string) error
	RespData(ctx echo.Context, data interface{}, errmsg ...string) error
	RespFail(ctx echo.Context, errmsg ...string) error
	Resp(ctx echo.Context, code int, resp Response) error
}

EchoResponse Echo Response interface

type GinQuickResp

type GinQuickResp struct{}

GinQuickResp gin quick response

func (*GinQuickResp) Resp

func (r *GinQuickResp) Resp(ctx *gin.Context, code int, resp Response)

Resp consume resp body

func (*GinQuickResp) RespBadRequest

func (r *GinQuickResp) RespBadRequest(ctx *gin.Context, errmsg ...string)

RespBadRequest means the client param error

func (*GinQuickResp) RespData

func (r *GinQuickResp) RespData(ctx *gin.Context, data interface{}, errmsg ...string)

RespData data response

func (*GinQuickResp) RespFail

func (r *GinQuickResp) RespFail(ctx *gin.Context, errmsg ...string)

RespFail business fail code

func (*GinQuickResp) RespNotFound

func (r *GinQuickResp) RespNotFound(ctx *gin.Context, errmsg ...string)

RespNotFound means resource not found

func (*GinQuickResp) RespOk

func (r *GinQuickResp) RespOk(ctx *gin.Context, errmsg ...string)

RespOk response mean's ok

type GinResponse

type GinResponse interface {
	RespOk(ctx *gin.Context, errmsg ...string)
	RespBadRequest(ctx *gin.Context, errmsg ...string)
	RespNotFound(ctx *gin.Context, errmsg ...string)
	RespData(ctx *gin.Context, data interface{}, errmsg ...string)
	Resp(ctx *gin.Context, code int, resp Response)
	RespFail(ctx *gin.Context, errmsg ...string)
}

GinResponse gin response interface

type Response

type Response struct {
	ErrMsg  string      `json:"errmsg"`
	ErrCode int         `json:"errcode"`
	Data    interface{} `json:"data"`
}

Response web response struct

Jump to

Keyboard shortcuts

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