response

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(c *gin.Context, message string)

func Conflict

func Conflict(c *gin.Context, code, message string, details any)

func Created

func Created(c *gin.Context, data any)

func Err

func Err(c *gin.Context, status int, code, message string)

func ErrWithDetails

func ErrWithDetails(c *gin.Context, status int, code, message string, details any)

func Forbidden

func Forbidden(c *gin.Context, message string)

func Internal

func Internal(c *gin.Context)

func NoContent

func NoContent(c *gin.Context)

func NotFound

func NotFound(c *gin.Context, message string)

func OK

func OK(c *gin.Context, data any)

func Unauthorized

func Unauthorized(c *gin.Context, message string)

Types

type Envelope

type Envelope struct {
	Success bool   `json:"success"`
	Data    any    `json:"data,omitempty"`
	Error   *Error `json:"error,omitempty"`
}

Envelope is the standard API response format.

{"success": true, "data": {...}}
{"success": false, "error": {"code": "LICENSE_NOT_FOUND", "message": "..."}}

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Details any    `json:"details,omitempty"`
}

Jump to

Keyboard shortcuts

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