rest

package
v0.0.0-...-e06075d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccCode = 0 // succeed

	ParamsParseErr   = 2001
	ParamsMissingErr = 2002
	ParamsInvalidErr = 2003

	InternalServerErr = 2010
)

common error code

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonResponse

type CommonResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

CommonResponse common rest response

func ErrorResponse

func ErrorResponse(errCode int, msg string) *CommonResponse

ErrorResponse generate error response Param code: error code Param msg: additional messages for the error, can be nil

func SuccessResponse

func SuccessResponse(data interface{}) *CommonResponse

SuccessResponse generate success response

Jump to

Keyboard shortcuts

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