UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server. Only one unary interceptor can be installed. The construction of multiple interceptors (e.g., chaining) can be implemented at the caller.
(i UnaryServerInterceptor)
| 483 | // server. Only one unary interceptor can be installed. The construction of multiple |
| 484 | // interceptors (e.g., chaining) can be implemented at the caller. |
| 485 | func UnaryInterceptor(i UnaryServerInterceptor) ServerOption { |
| 486 | return newFuncServerOption(func(o *serverOptions) { |
| 487 | if o.unaryInt != nil { |
| 488 | panic("The unary server interceptor was already set and may not be reset.") |
| 489 | } |
| 490 | o.unaryInt = i |
| 491 | }) |
| 492 | } |
| 493 | |
| 494 | // ChainUnaryInterceptor returns a ServerOption that specifies the chained interceptor |
| 495 | // for unary RPCs. The first interceptor will be the outer most, |