Documentation
¶
Index ¶
- func BadRequest(c *app.RequestContext, message string)
- func Created(c *app.RequestContext, data interface{})
- func Error(c *app.RequestContext, statusCode int, message string)
- func InternalError(c *app.RequestContext, message string)
- func NoContent(c *app.RequestContext)
- func NotFound(c *app.RequestContext, message string)
- func Paginated(c *app.RequestContext, list interface{}, total int64, page, pageSize int)
- func Success(c *app.RequestContext, data interface{})
- type BatchResponse
- type PaginatedData
- type Pagination
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(c *app.RequestContext, message string)
BadRequest sends a 400 Bad Request response
func Created ¶
func Created(c *app.RequestContext, data interface{})
Created sends a 201 Created response
func Error ¶
func Error(c *app.RequestContext, statusCode int, message string)
Error sends an error response with a custom status code (kept for backward compatibility)
func InternalError ¶
func InternalError(c *app.RequestContext, message string)
InternalError sends a 500 Internal Server Error response. 出于安全:原始 detail 只写入服务端日志,不回传客户端(避免泄露 SQL/DSN/表名/文件路径等内部信息)。
func NotFound ¶
func NotFound(c *app.RequestContext, message string)
NotFound sends a 404 Not Found response
func Paginated ¶
func Paginated(c *app.RequestContext, list interface{}, total int64, page, pageSize int)
Paginated sends a 200 OK response with pagination data
func Success ¶
func Success(c *app.RequestContext, data interface{})
Success sends a 200 OK response
Types ¶
type BatchResponse ¶
type BatchResponse struct {
Total int `json:"total"`
Success int `json:"success"`
Failed int `json:"failed"`
Errors []string `json:"errors,omitempty"`
}
BatchResponse 批量操作响应
type PaginatedData ¶
type PaginatedData struct {
List interface{} `json:"list"`
Pagination Pagination `json:"pagination"`
}
PaginatedData 分页数据
Click to show internal directories.
Click to hide internal directories.