ginx

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const StatusCode = "StatusCode"

Variables

This section is empty.

Functions

func AbortResponse

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

func AbortResponseWithCode

func AbortResponseWithCode(c *gin.Context, code int, err error)

func GetBodyData

func GetBodyData(c *gin.Context, ReqBodyKey string) []byte

Get body data from context

func ParseParamID

func ParseParamID(c *gin.Context, key string) uint64

Param returns the value of the URL param

func ResBadRequestJson

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

func ResErrJson

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

failed Json Response

func ResErrJsonWithCode

func ResErrJsonWithCode(c *gin.Context, code int, err error)

func ResList

func ResList(c *gin.Context, list interface{}, totalCount int)

list Response

func ResOKJson

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

success Json Response

Types

type HttpError

type HttpError struct {
	Code        string      `json:"code"`
	Description string      `json:"description"`
	Solution    string      `json:"solution,omitempty"`
	Cause       string      `json:"cause,omitempty"`
	Detail      interface{} `json:"detail,omitempty"`
	Data        interface{} `json:"data,omitempty"`
}

type ValidError

type ValidError struct {
	Key     string
	Message string
}

func (*ValidError) Error

func (v *ValidError) Error() string

type ValidErrors

type ValidErrors []*ValidError

func BindAndValid

func BindAndValid(c *gin.Context, v interface{}) (bool, ValidErrors)

func (ValidErrors) Error

func (v ValidErrors) Error() string

func (ValidErrors) Errors

func (v ValidErrors) Errors() []string

Jump to

Keyboard shortcuts

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