Documentation ¶
Index ¶
- func ErrorHandler(logger log.Logger) http2.Middleware
- func MaxRequestBodySize(maxBytes int64) http2.Middleware
- func Metrics(storage *http_metrics.ServerStorage) http2.Middleware
- func Recovery() http2.Middleware
- func RequestId() http2.Middleware
- type Caller
- type HttpError
- type JsonRequestExtractor
- type JsonResponseMapper
- type LogMiddleware
- type ParamBuilder
- type ParamMapper
- type RequestBodyExtractor
- type ResponseBodyMapper
- type Validator
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(logger log.Logger) http2.Middleware
func MaxRequestBodySize ¶
func MaxRequestBodySize(maxBytes int64) http2.Middleware
func Metrics ¶
func Metrics(storage *http_metrics.ServerStorage) http2.Middleware
func Recovery ¶
func Recovery() http2.Middleware
func RequestId ¶
func RequestId() http2.Middleware
Types ¶
type Caller ¶
type Caller struct {
// contains filtered or unexported fields
}
func NewCaller ¶
func NewCaller( f any, bodyExtractor RequestBodyExtractor, bodyMapper ResponseBodyMapper, paramMappers map[string]ParamMapper, ) (*Caller, error)
type HttpError ¶
type HttpError interface {
WriteError(w http.ResponseWriter) error
}
type JsonRequestExtractor ¶
type JsonRequestExtractor struct {
Validator Validator
}
type JsonResponseMapper ¶
type JsonResponseMapper struct { }
func (JsonResponseMapper) Map ¶
func (j JsonResponseMapper) Map(ctx context.Context, result any, w http.ResponseWriter) error
type LogMiddleware ¶ added in v1.40.0
type LogMiddleware http2.Middleware
func LogWithContentTypes ¶ added in v1.40.0
func LogWithContentTypes(logger log.Logger, logBody bool, logBodyContentTypes []string) LogMiddleware
func Noop ¶ added in v1.40.0
func Noop() LogMiddleware
type ParamBuilder ¶
type ParamMapper ¶
type ParamMapper struct { Type string Builder ParamBuilder }
func ContextParam ¶
func ContextParam() ParamMapper
func RequestParam ¶
func RequestParam() ParamMapper
func ResponseWriterParam ¶
func ResponseWriterParam() ParamMapper
type RequestBodyExtractor ¶
type ResponseBodyMapper ¶
type Wrapper ¶
type Wrapper struct { ParamMappers map[string]ParamMapper BodyExtractor RequestBodyExtractor BodyMapper ResponseBodyMapper Middlewares []http2.Middleware Logger log.Logger }
func DefaultWrapper ¶
func DefaultWrapper(logger log.Logger, logMiddleware LogMiddleware, restMiddlewares ...http.Middleware) Wrapper
func NewWrapper ¶
func NewWrapper( paramMappers []ParamMapper, bodyExtractor RequestBodyExtractor, bodyMapper ResponseBodyMapper, logger log.Logger, ) Wrapper
func (Wrapper) WithMiddlewares ¶
func (m Wrapper) WithMiddlewares(middlewares ...http2.Middleware) Wrapper
Source Files ¶
Click to show internal directories.
Click to hide internal directories.