response

package
v0.0.0-...-5693655 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CodeOK          = 200
	CodeBadRequest  = -401
	CodeNotFound    = 404
	CodeServerError = 500
)

Variables

This section is empty.

Functions

func BindAs

func BindAs[T any](c *gin.Context, binder func(any) error) (T, bool)

func BindAsError

func BindAsError[T any](c *gin.Context, binder func(any) error) (T, error)

func BindInto

func BindInto(c *gin.Context, binder func(any) error, dst any) bool

func BindIntoWithError

func BindIntoWithError(c *gin.Context, binder func(any) error, dst any) error

func Error

func Error(c *gin.Context, code int, msg string)

func ErrorWithData

func ErrorWithData(c *gin.Context, code int, msg string, data any)

func Success

func Success(c *gin.Context, data any, msg ...string)

Types

type Body

type Body struct {
	Code    int    `json:"code"`
	Msg     string `json:"msg"`
	Data    any    `json:"data,omitempty"`
	TraceID string `json:"trace_id,omitempty"`
}

Jump to

Keyboard shortcuts

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