v1

package
v0.0.0-...-a52508d Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SuccessResponse success response
	SuccessResponse = Response{Code: 1000, Message: "success"}

	// ErrInternalServer server internal
	ErrInternalServer = Response{Code: 1001, Message: "系统错误"}

	// ErrMissParams params miss
	ErrMissParams = Response{Code: 1002, Message: "缺少参数"}

	// ErrFailParams params fail
	ErrFailParams = Response{Code: 1003, Message: "参数格式错误"}

	// ErrNotExist record not find
	ErrNotExist = Response{Code: 1004, Message: "数据不存在"}
)
View Source
var BuildTime string

BuildTime build in time

View Source
var BuildVersion string

BuildVersion build in git last commit id

Functions

func Version

func Version(c *gin.Context)

Version 获取接口版本 @Produce json @Success 200 {object} api.Response @Failure 500 {object} api.Response @Router /api/v1/version [get]

Types

type Response

type Response struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

Response response struct

func NewErrMessageResponse

func NewErrMessageResponse(message string) Response

NewErrMessageResponse new error message

func NewErrResponse

func NewErrResponse(code int, message string) Response

NewErrResponse new error response

func NewResponseWithData

func NewResponseWithData(response Response, data interface{}) Response

NewResponseWithData 返回携带data的自定义响应

func NewSucResponse

func NewSucResponse(data interface{}) Response

NewSucResponse new success data

func (Response) Error

func (e Response) Error() string

Error print response error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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