httpwrap

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinRespond

func GinRespond[T any](c *gin.Context, httpStatus int, code int, msg string, body T)

func GinRespondError

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

func GinRespondOK

func GinRespondOK[T any](c *gin.Context, body T)

func Response

func Response[T any](ctx context.Context, w http.ResponseWriter, code int, msg string, body T)

func ResponseFail

func ResponseFail(ctx context.Context, w http.ResponseWriter, msg string)

func ResponseSucc

func ResponseSucc[T any](ctx context.Context, w http.ResponseWriter, body T)

Types

type ResponseHeadInfo

type ResponseHeadInfo struct {
	Code      int    `json:"code"`
	Msg       string `json:"msg"`
	RequestID string `json:"request_id"`
	Time      string `json:"time"`
}

type ResponseInfo

type ResponseInfo[T any] struct {
	Head ResponseHeadInfo `json:"head"`
	Body T                `json:"body,omitempty"`
}

Jump to

Keyboard shortcuts

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