response

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ContextKeyRequestID = "requestID"

ContextKeyRequestID must match the key used in middleware

Variables

This section is empty.

Functions

func Error

func Error(c *gin.Context, err error)

Error sends an error response

func Success

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

Success sends a success response

Types

type PageResult

type PageResult struct {
	List     interface{} `json:"list"`
	Total    int         `json:"total"`
	Page     int         `json:"page"`
	PageSize int         `json:"page_size"`
}

PageResult standard structure for pagination

type Response

type Response struct {
	Code    int         `json:"code"`               // Business Code
	Message string      `json:"message"`            // Message
	Data    interface{} `json:"data,omitempty"`     // Data payload
	TraceID string      `json:"trace_id,omitempty"` // Request ID for tracing
}

Response standard structure

Jump to

Keyboard shortcuts

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