Documentation ¶
Overview ¶
Package middleware is the package that holds the middleware logict for rest layer
Package middleware is the package that holds the middleware logict for rest layer
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RequestCounterVec = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "http", Subsystem: "requests", Name: "number_of_requests", Help: "Total number of requests handled by the API", }, []string{"endpoint", "method"}, ) )
RequestCounterVec counts total request per endpoint and method
View Source
var ( RequestDurationGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "http", Subsystem: "requests", Name: "request_duration", Help: "Avg time of requests handled by the API", }, []string{"endpoint", "method"}, ) )
RequestDurationGauge calculates avg time per endpoint and method
Functions ¶
Types ¶
type Validation ¶
type Validation struct {
// contains filtered or unexported fields
}
Validation contains the *validator.Validate instance
func (*Validation) Validate ¶
func (v *Validation) Validate(i interface{}) ValidationErrors
Validate validates the models
type ValidationError ¶
type ValidationError struct {
validator.FieldError
}
ValidationError wraps the validators FieldError, so we do not expose this to out code
func (ValidationError) Error ¶
func (v ValidationError) Error() string
Error returns the error message for validation
type ValidationErrors ¶
type ValidationErrors []ValidationError
ValidationErrors is a collection of ValidationError
func (ValidationErrors) Errors ¶
func (v ValidationErrors) Errors() []string
Errors converts the slice into a string slice
Click to show internal directories.
Click to hide internal directories.