response

package
v0.0.11-otel Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XRequestID   = "X-Request-ID"
	RequestIDKey = "request_id"
	TraceIDKey   = "trace_id"
)

Variables

This section is empty.

Functions

func FromHTTPResponse

func FromHTTPResponse[T any](response *HTTPResponse) *T

func GinError

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

func GinParamError

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

func GinSuccess

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

Types

type HTTPResponse

type HTTPResponse struct {
	Code      int    `json:"code"`
	Message   string `json:"message"`
	RequestID string `json:"request_id"`
	TraceID   string `json:"trace_id"`
	Data      any    `json:"data"`
}

func NewHTTPResponse

func NewHTTPResponse(bs []byte) *HTTPResponse

Jump to

Keyboard shortcuts

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