Versions in this module Expand all Collapse all v0 v0.0.1 Aug 13, 2022 Changes in this version + const AuthorizationHeaderKey + const AuthorizationTypeBear + var ErrNotfound = errors.New("cannot found") + func Authorization(version string, tokenMaker token.Maker) gin.HandlerFunc + func CORS() gin.HandlerFunc + func GetAuthPayload(c *gin.Context) *token.Payload + func GetTokenMaker(c *gin.Context) token.Maker + func GetUserID(c *gin.Context) (int64, error) + func GetUsername(c *gin.Context) (string, error) + func Jsonifier(version string) gin.HandlerFunc + func LimitRate(version string, maxRequestsPerSecond int) gin.HandlerFunc + func Logger(logger *zap.Logger) gin.HandlerFunc + func ModifyResponse(urls *set.Set, cb func(c *gin.Context, url string, body *bytes.Buffer)) gin.HandlerFunc + func NewMetric(m *Metric, namespace, subsystem string) prometheus.Collector + func Recovery(version string, logger *zap.Logger, stack bool) gin.HandlerFunc + func SetErr(c *gin.Context, statusCode int, err error) + func SetErrWithTraceBack(c *gin.Context, statusCode int, err error) + func SetResp(c *gin.Context, value interface{}) + func SetTokenMaker(maker token.Maker) gin.HandlerFunc + type Error struct + Message string + StatusCode *int + TraceBack string + type Metric struct + Args []string + Description string + ID string + MetricCollector prometheus.Collector + Name string + Type string + type Prometheus struct + MetricsList []*Metric + MetricsPath string + Ppg PrometheusPushGateway + ReqCntURLLabelMappingFn RequestCounterURLLabelMappingFn + URLLabelFromContext string + func NewPrometheus(namespace, subsystem string, customMetricsList ...[]*Metric) *Prometheus + func (p *Prometheus) HandlerFunc() gin.HandlerFunc + func (p *Prometheus) SetListenAddress(address string) + func (p *Prometheus) SetListenAddressWithRouter(listenAddress string, r *gin.Engine) + func (p *Prometheus) SetMetricsPath(e *gin.Engine) + func (p *Prometheus) SetMetricsPathWithAuth(e *gin.Engine, accounts gin.Accounts) + func (p *Prometheus) SetPushGateway(pushGatewayURL, metricsURL string, pushInterval time.Duration) + func (p *Prometheus) SetPushGatewayJob(j string) + func (p *Prometheus) Use(e *gin.Engine) + func (p *Prometheus) UseWithAuth(e *gin.Engine, accounts gin.Accounts) + type PrometheusPushGateway struct + Job string + MetricsURL string + PushGatewayURL string + PushInterval time.Duration + type RequestCounterURLLabelMappingFn func(c *gin.Context) string + type Response struct + Error interface{} + Result interface{} + Success bool + Version string + type ResponseBufferWriter struct + func NewResponseBufferWriter(w gin.ResponseWriter) *ResponseBufferWriter + func (w *ResponseBufferWriter) Flush() + func (w *ResponseBufferWriter) Size() int + func (w *ResponseBufferWriter) Status() int + func (w *ResponseBufferWriter) Write(buf []byte) (int, error) + func (w *ResponseBufferWriter) WriteHeader(status int) + func (w *ResponseBufferWriter) WriteString(s string) (int, error) + func (w *ResponseBufferWriter) Written() bool