Documentation ¶
Index ¶
- Constants
- Variables
- func Cors() gin.HandlerFunc
- func JWT(skippers ...SkipperFunc) gin.HandlerFunc
- func Logger(logger log.Logger, skippers ...SkipperFunc) gin.HandlerFunc
- func MethodNotAllow(ctx *gin.Context)
- func Metrics() gin.HandlerFunc
- func PathNotFound(ctx *gin.Context)
- func Recovery() gin.HandlerFunc
- func RequestId() gin.HandlerFunc
- func SkipHandler(c *gin.Context, skippers ...SkipperFunc) bool
- func Timeout(timeout time.Duration) gin.HandlerFunc
- func Tracer() gin.HandlerFunc
- type Operation
- type ResponseWithRecorder
- type SkipperFunc
Constants ¶
View Source
const (
// XRequestIDKey defines X-Request-ID key string.
XRequestIDKey = "X-Request-ID"
)
Variables ¶
View Source
var ( HttpRequestCounter *prometheus.CounterVec HttpRequestLatency *prometheus.HistogramVec HttpRequestConcurrency *prometheus.GaugeVec )
Functions ¶
func Cors ¶
func Cors() gin.HandlerFunc
func MethodNotAllow ¶
func Metrics ¶
func Metrics() gin.HandlerFunc
func RequestId ¶
func RequestId() gin.HandlerFunc
func SkipHandler ¶
func SkipHandler(c *gin.Context, skippers ...SkipperFunc) bool
Types ¶
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
func (*Operation) RecordOperation ¶
func (op *Operation) RecordOperation(skippers ...SkipperFunc) gin.HandlerFunc
Logger 日志记录
type ResponseWithRecorder ¶
type ResponseWithRecorder struct { gin.ResponseWriter // contains filtered or unexported fields }
func (*ResponseWithRecorder) Write ¶
func (rec *ResponseWithRecorder) Write(d []byte) (n int, err error)
func (*ResponseWithRecorder) WriteHeader ¶
func (rec *ResponseWithRecorder) WriteHeader(statusCode int)
type SkipperFunc ¶
中间件跳过
func PathContainSkipper ¶
func PathContainSkipper(prefixs ...string) SkipperFunc
func PathPrefixSkipper ¶
func PathPrefixSkipper(prefixs ...string) SkipperFunc
Click to show internal directories.
Click to hide internal directories.