rip

package
v1.36.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: GPL-3.0 Imports: 17 Imported by: 18

Documentation

Index

Constants

View Source
const (
	BestCompression    = gzip.BestCompression
	BestSpeed          = gzip.BestSpeed
	DefaultCompression = gzip.DefaultCompression
	NoCompression      = gzip.NoCompression
)

Variables

This section is empty.

Functions

func Fail

func Fail(w http.ResponseWriter, gerr gobol.Error)

func FromJSON

func FromJSON(r *http.Request, t Validator) gobol.Error

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 SetLogger

func SetLogger(forceErrorToDebugLog bool)

func Success

func Success(w http.ResponseWriter, statusCode int, payload []byte)

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) Write

func (w *GzipResponseWriter) Write(b []byte) (int, error)

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) Write

func (w *LogResponseWriter) Write(b []byte) (int, error)

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

type Validator

type Validator interface {
	Validate() gobol.Error
}

Jump to

Keyboard shortcuts

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