@@ -16,6 +16,8 @@ import (
16
16
// Execution is done in left-to-right order, including passing of context.
17
17
// For example ChainUnaryServer(one, two, three) will execute one before two before three, and three
18
18
// will see context changes of one and two.
19
+ //
20
+ // While this can be useful in some scenarios, it is generally advisable to use google.golang.org/grpc.ChainUnaryInterceptor directly.
19
21
func ChainUnaryServer (interceptors ... grpc.UnaryServerInterceptor ) grpc.UnaryServerInterceptor {
20
22
n := len (interceptors )
21
23
@@ -40,6 +42,8 @@ func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnarySer
40
42
// Execution is done in left-to-right order, including passing of context.
41
43
// For example ChainUnaryServer(one, two, three) will execute one before two before three.
42
44
// If you want to pass context between interceptors, use WrapServerStream.
45
+ //
46
+ // While this can be useful in some scenarios, it is generally advisable to use google.golang.org/grpc.ChainStreamInterceptor directly.
43
47
func ChainStreamServer (interceptors ... grpc.StreamServerInterceptor ) grpc.StreamServerInterceptor {
44
48
n := len (interceptors )
45
49
@@ -109,12 +113,16 @@ func ChainStreamClient(interceptors ...grpc.StreamClientInterceptor) grpc.Stream
109
113
//
110
114
// WithUnaryServerChain is a grpc.Server config option that accepts multiple unary interceptors.
111
115
// Basically syntactic sugar.
116
+ //
117
+ // Deprecated: use google.golang.org/grpc.ChainUnaryInterceptor instead.
112
118
func WithUnaryServerChain (interceptors ... grpc.UnaryServerInterceptor ) grpc.ServerOption {
113
- return grpc .UnaryInterceptor ( ChainUnaryServer ( interceptors ... ) )
119
+ return grpc .ChainUnaryInterceptor ( interceptors ... )
114
120
}
115
121
116
122
// WithStreamServerChain is a grpc.Server config option that accepts multiple stream interceptors.
117
123
// Basically syntactic sugar.
124
+ //
125
+ // Deprecated: use google.golang.org/grpc.ChainStreamInterceptor instead.
118
126
func WithStreamServerChain (interceptors ... grpc.StreamServerInterceptor ) grpc.ServerOption {
119
- return grpc .StreamInterceptor ( ChainStreamServer ( interceptors ... ) )
127
+ return grpc .ChainStreamInterceptor ( interceptors ... )
120
128
}
0 commit comments