Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapF ¶
func WrapF(f HandlerFunc) gin.HandlerFunc
WrapF is a helper function for wrapping handler.HandlerFunc and returns a Gin middleware.
func WrapFD ¶
func WrapFD(f HandlerDataFunc) gin.HandlerFunc
WrapFD is a helper function for wrapping handler.HandlerDataFunc and returns a Gin middleware.
func WrapH ¶
func WrapH(h Handler) gin.HandlerFunc
WrapH is a helper function for wrapping handler.Handler and returns a Gin middleware.
Types ¶
type Duration ¶
func (Duration) MarshalJSON ¶
type Handler ¶
type Handler interface { Validate(c *gin.Context) error Handle(c *gin.Context, log logrus.FieldLogger) (any, error) }
The Handler is an abstract of handle request
type HandlerDataFunc ¶
The HandlerDataFunc type is an adapter to allow the use of ordinary functions as HTTP handlers. If f is a function with the appropriate signature, HandlerDataFunc(f) is a Handler that calls f.
type HandlerFunc ¶
type HandlerFunc func(c *gin.Context, log logrus.FieldLogger) error
The HandlerFunc type is an adapter to allow the use of ordinary functions as HTTP handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler that calls f.
type Pagination ¶
type Pagination struct { // Page is the page number, starting from 1. // Required: true, Minimum value: 1 Page int `json:"page" binding:"required,gte=1"` // PerPage is the number of items per page. // Required: true, Minimum value: 1, Maximum value: 300 PerPage int `json:"perPage" binding:"required,gte=1,lte=300"` }
Pagination represents the pagination parameters for a request.
type Response ¶
type Response struct { Success bool `json:"success" yaml:"success"` Code string `json:"code" yaml:"code"` Message string `json:"message" yaml:"message"` Data any `json:"data,omitempty" yaml:"data,omitempty"` TraceID string `json:"traceID,omitempty" yaml:"traceID,omitempty"` StartTime time.Time `json:"startTime,omitempty" yaml:"startTime,omitempty"` EndTime time.Time `json:"endTime,omitempty" yaml:"endTime,omitempty"` CostTime Duration `json:"costTime,omitempty" yaml:"costTime,omitempty"` }