app

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS        = 200
	CREATED        = 201
	ERROR          = 500
	INVALID_PARAMS = 400
	NOT_AUTHORIED  = 403
	NOT_FOUND      = 404
	ALREADY_EXIST  = 409
)

Variables

View Source
var Msg = map[int]string{
	SUCCESS:        "OK",
	CREATED:        "Created",
	ERROR:          "Fail",
	INVALID_PARAMS: "Invalid Parameters",
	NOT_AUTHORIED:  "Client Not Authorized",
	NOT_FOUND:      "Resource Not Found",
	ALREADY_EXIST:  "Resource Already Exist",
}

Functions

func GetMsg

func GetMsg(code int) (m string)

GetMsg returns the message to corresponding error code

Types

type GoatResponse

type GoatResponse struct {
	Context *gin.Context `json:"-"`
	Code    int          `json:"code"`
	Msg     string       `json:"msg"`
	Data    interface{}  `json:"data"`
}

GoatResponse defines the structure of response data

func (GoatResponse) Response

func (c GoatResponse) Response(status_code, err_code int, data interface{})

Jump to

Keyboard shortcuts

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