github.com/kaydxh/golang@v0.0.131/pkg/middleware/local.middleware.wrap.go (about) 1 package middleware 2 3 import ( 4 "context" 5 6 interceptordebug_ "github.com/kaydxh/golang/pkg/middleware/grpc-middleware/debug" 7 interceptoropentelemetry_ "github.com/kaydxh/golang/pkg/middleware/grpc-middleware/monitor/opentelemetry" 8 ) 9 10 // the function need to called by controller 11 func LocalMiddlewareWrap[REQ any, RESP any](handler func(ctx context.Context, req REQ) (RESP, error)) func(ctx context.Context, req REQ) (RESP, error) { 12 return interceptordebug_.HandleReuestId( 13 interceptordebug_.HandleInOutputPrinter( 14 nil, 15 interceptoropentelemetry_.HandleMetric( 16 handler, 17 ))) 18 } 19 20 // the function need to called by controller, without inout printer 21 func LocalTinyMiddlewareWrap[REQ any, RESP any](handler func(ctx context.Context, req REQ) (RESP, error)) func(ctx context.Context, req REQ) (RESP, error) { 22 return interceptordebug_.HandleReuestId( 23 interceptoropentelemetry_.HandleMetric( 24 handler, 25 )) 26 }