midkit

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingInterceptor

func LoggingInterceptor(logger *slog.Logger) grpc.UnaryServerInterceptor

LoggingInterceptor is a gRPC unary server interceptor that logs method calls and their durations. It takes a logger instance as input and returns a UnaryServerInterceptor function.

func MetricsInterceptor

func MetricsInterceptor() grpc.UnaryServerInterceptor

func ProfilerMiddleware

func ProfilerMiddleware() http.Handler

Types

type Middleware

type Middleware = func(next http.Handler) http.Handler

Middleware represents a function type that serves as a middleware in an HTTP server. It takes the next http.Handler as a parameter and returns an http.Handler. The middleware function is responsible for intercepting and processing HTTP requests and responses.

func CORSMiddleware

func CORSMiddleware(o cors.Options) Middleware

func LoggingMiddleware

func LoggingMiddleware(logger *slog.Logger) Middleware

LoggingMiddleware represents logging middleware.

func MetricsMiddleware

func MetricsMiddleware() Middleware

MetricsMiddleware represents HTTP metrics collecting middlewares.

func RecoveryMiddleware

func RecoveryMiddleware() Middleware

func RedirectSlashesMiddleware

func RedirectSlashesMiddleware() Middleware

type StreamInterceptor

type StreamInterceptor = grpc.StreamServerInterceptor

StreamInterceptor is an alias for grpc.StreamServerInterceptor. It is used as a middleware to intercept streaming RPC calls in a gRPC server.

type UnaryInterceptor

type UnaryInterceptor = grpc.UnaryServerInterceptor

UnaryInterceptor is an alias for grpc.UnaryServerInterceptor. It is used as a middleware to intercept unary RPC calls in a gRPC server.

Jump to

Keyboard shortcuts

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