grpc/interceptors/recovery/interceptors.go
Adphi df505b58d7
rename module grpc-toolkit
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2023-07-08 01:33:10 +02:00

25 lines
613 B
Go

package recovery
import (
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
"google.golang.org/grpc"
"go.linka.cloud/grpc-toolkit/interceptors"
)
func NewInterceptors(opts ...grpc_recovery.Option) interceptors.ServerInterceptors {
return &recovery{opts: opts}
}
type recovery struct {
opts []grpc_recovery.Option
}
func (i *recovery) UnaryServerInterceptor() grpc.UnaryServerInterceptor {
return grpc_recovery.UnaryServerInterceptor(i.opts...)
}
func (i *recovery) StreamServerInterceptor() grpc.StreamServerInterceptor {
return grpc_recovery.StreamServerInterceptor(i.opts...)
}