Documentation ¶
Index ¶
- Constants
- func Fail(w http.ResponseWriter, gerr gobol.Error)
- func FromJSON(r *http.Request, t Validator) gobol.Error
- func NewCustomRouter() *httprouter.Router
- func NewCustomRouterMapError(errorMessagesFile string) *httprouter.Router
- func SetLogger(forceErrorToDebugLog bool)
- func Success(w http.ResponseWriter, statusCode int, payload []byte)
- func SuccessJSON(w http.ResponseWriter, statusCode int, payload interface{})
- type GzipHandler
- type GzipResponseWriter
- type LogHandler
- type LogResponseWriter
- type StatisticsInterface
- type Validator
Constants ¶
View Source
const ( BestCompression = gzip.BestCompression BestSpeed = gzip.BestSpeed DefaultCompression = gzip.DefaultCompression NoCompression = gzip.NoCompression )
Variables ¶
This section is empty.
Functions ¶
func NewCustomRouter ¶
func NewCustomRouter() *httprouter.Router
func NewCustomRouterMapError ¶ added in v1.32.0
func NewCustomRouterMapError(errorMessagesFile string) *httprouter.Router
NewCustomRouterMapError returns a httprouter.Router and maps error code to error messages according to errorMessagesFile
func SuccessJSON ¶
func SuccessJSON(w http.ResponseWriter, statusCode int, payload interface{})
Types ¶
type GzipHandler ¶
type GzipHandler struct {
// contains filtered or unexported fields
}
func NewGzipMiddleware ¶
func NewGzipMiddleware(level int, next http.Handler) *GzipHandler
func (*GzipHandler) ServeHTTP ¶
func (h *GzipHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type GzipResponseWriter ¶
type GzipResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func (*GzipResponseWriter) Header ¶
func (w *GzipResponseWriter) Header() http.Header
func (*GzipResponseWriter) WriteHeader ¶
func (w *GzipResponseWriter) WriteHeader(s int)
type LogHandler ¶
type LogHandler struct {
// contains filtered or unexported fields
}
LogHandler - add statistics from requests
func NewLogMiddleware ¶
func NewLogMiddleware(next http.Handler, port int, statisticsImpl StatisticsInterface) *LogHandler
NewLogMiddleware - creates a new instance of LogHandler
func (*LogHandler) ServeHTTP ¶
func (h *LogHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP - implements the interface to serve http requests
type LogResponseWriter ¶
type LogResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func (*LogResponseWriter) Header ¶
func (w *LogResponseWriter) Header() http.Header
func (*LogResponseWriter) WriteHeader ¶
func (w *LogResponseWriter) WriteHeader(s int)
type StatisticsInterface ¶ added in v1.33.0
type StatisticsInterface interface { // Increment - increments a metric Increment(metric string, tags ...interface{}) // Maximum - input a maximum operation Maximum(metric string, value float64, tags ...interface{}) }
StatisticsInterface - defines an interface to input request statistics
Click to show internal directories.
Click to hide internal directories.