Documentation ¶
Index ¶
- Constants
- Variables
- func CompressionMiddleware(next natsmicromw.MicroHandlerFunc) natsmicromw.MicroHandlerFunc
- func GetCompressMin() int
- func MetricsContextMiddleware(next natsmicromw.ContextHandlerFunc) natsmicromw.ContextHandlerFunc
- func MetricsMicroMiddleware(next natsmicromw.MicroHandlerFunc) natsmicromw.MicroHandlerFunc
- func MetricsMiddleware(next micro.Handler) micro.Handler
- func RequestIdFromContext(ctx context.Context) string
- func RequestIdMicroMiddleware(tags ...string) func(next natsmicromw.MicroHandlerFunc) natsmicromw.MicroHandlerFunc
- func RequestIdMiddleware(tags ...string) func(next natsmicromw.ContextHandlerFunc) natsmicromw.ContextHandlerFunc
- func SetCompressMin(minBytes int)
- type CompressionType
Constants ¶
View Source
const ( CompressionNone CompressionType = "" CompressionGzip CompressionType = "gzip" CompressionDeflate CompressionType = "deflate" HeaderAcceptEncoding string = "accept-encoding" HeaderEncoding = "encoding" )
Variables ¶
View Source
var (
ErrUnsupportedEncoding = errors.New("unsupported encoding")
)
Functions ¶
func CompressionMiddleware ¶ added in v0.1.0
func CompressionMiddleware(next natsmicromw.MicroHandlerFunc) natsmicromw.MicroHandlerFunc
func GetCompressMin ¶ added in v0.1.0
func GetCompressMin() int
GetCompressMin retrieves the current global minimum size for compression.
func MetricsContextMiddleware ¶ added in v0.0.3
func MetricsContextMiddleware(next natsmicromw.ContextHandlerFunc) natsmicromw.ContextHandlerFunc
Same middleware but with context support
func MetricsMicroMiddleware ¶ added in v0.1.0
func MetricsMicroMiddleware(next natsmicromw.MicroHandlerFunc) natsmicromw.MicroHandlerFunc
One more version for `MicroRequest` and `MicroReply`
func MetricsMiddleware ¶
Middleware that increments the message count metric
func RequestIdFromContext ¶
Get current request Id from the context
func RequestIdMicroMiddleware ¶ added in v0.1.0
func RequestIdMicroMiddleware(tags ...string) func(next natsmicromw.MicroHandlerFunc) natsmicromw.MicroHandlerFunc
Same example with `MicroRequest` and `MicroReply`
func RequestIdMiddleware ¶
func RequestIdMiddleware(tags ...string) func(next natsmicromw.ContextHandlerFunc) natsmicromw.ContextHandlerFunc
An example request id middleware
func SetCompressMin ¶ added in v0.1.0
func SetCompressMin(minBytes int)
SetCompressMin sets the global minimum size for compression.
Types ¶
type CompressionType ¶ added in v0.1.0
type CompressionType string
Click to show internal directories.
Click to hide internal directories.