response

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForm = &Msg{
		Code: cErrForm,
		Msg:  "illegal request parameter",
	}
	ErrDBOperation = &Msg{
		Code: cErrDBOperation,
		Msg:  "server internal error",
	}
	ErrReachLimit = &Msg{
		Code: cErrReachLimit,
		Msg:  "server busy",
	}
	ErrUnexpected = &Msg{
		Code: cErrUnexpected,
		Msg:  "unexpected error",
	}
	ErrNotFound = &Msg{
		Code: cErrNotFound,
		Msg:  "not found",
	}
	ErrTelegram = &Msg{
		Code: cErrTelegram,
		Msg:  "telegram error",
	}
	ErrResourceConflict = &Msg{
		Code: cErrResourceConflict,
		Msg:  "resource conflict",
	}
)

Functions

func Default

func Default(ctx *gin.Context)

func Error

func Error(ctx *gin.Context, msg *Msg, args ...any)

func ErrorWithTip

func ErrorWithTip(ctx *gin.Context, msg *Msg, tip string, args ...any)

func Success

func Success(ctx *gin.Context, data interface{})

Types

type Msg

type Msg struct {
	Code uint8       `json:"code"`
	Msg  string      `json:"msg,omitempty"`
	Data interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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