Help us shape the future of Go! Take the 2026 Go Developer Survey

response

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess      = "00000"
	CodeNotFound     = "B0001"
	CodeParamsError  = "B0002"
	CodeNotLogin     = "B1001"
	CodeNoPermission = "B1002"
	CodeBanned       = "B1003"
	CodeServerError  = "A0001"

	MessageSuccess      = "success"
	MessageNotFound     = "not found"
	MessageParamsError  = "params error"
	MessageNotLogin     = "not login"
	MessageNoPermission = "no permission"
	MessageServerError  = "server error"
	MessageBanned       = "your account has been banned"

	MessageUnknown = "unknown error"
)

Variables

This section is empty.

Functions

func Error

func Error(ctx *gin.Context, code string)

func ErrorWithMsg

func ErrorWithMsg(ctx *gin.Context, code string, msg string)

func New

func New(ctx *gin.Context, httpCode int, code string, msg string, data any)

func Success

func Success(ctx *gin.Context, data any)

Types

type Response

type Response struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

Jump to

Keyboard shortcuts

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