func (ui *unaryServerInterceptor) Interceptor() grpc.UnaryServerInterceptor {
	return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
		// TODO: Find a more efficient way
		interceptor := handler
		ui.lock.RLock()
		for idx := len(ui.interceptors) - 1; idx >= 0; idx-- {
			interceptor = chainUnaryServerInterceptor(ui.interceptors[idx], info, interceptor)
		}
		ui.lock.RUnlock()
		return interceptor(ctx, req)
	}
}
// Interceptor chains all added interceptors into a single
// `grpc.UnaryServerInterceptor`.
//
// The `handler` passed to each interceptor is either the next interceptor or,
// for the last element of the chain, the target method.
Interceptor chains all added interceptors into a single
`grpc.UnaryServerInterceptor`.

The `handler` passed to each interceptor is either the next interceptor or,
for the last element of the chain, the target method.
// Interceptor chains all added interceptors into a single // ` grpc . UnaryServerInterceptor ` . // // The ` handler ` passed to each interceptor is either the next interceptor or // for the last element of the chain the target method .
func (ui *unaryServerInterceptor) Interceptor() grpc.UnaryServerInterceptor {
	return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
		interceptor := handler
		ui.lock.RLock()
		for idx := len(ui.interceptors) - 1; idx >= 0; idx-- {
			interceptor = chainUnaryServerInterceptor(ui.interceptors[idx], info, interceptor)
		}
		ui.lock.RUnlock()
		return interceptor(ctx, req)
	}
}
func ( ui * unaryServerInterceptor ) Interceptor ( ) grpc . UnaryServerInterceptor { return func ( ctx context . Context , req interface { } , info * grpc . UnaryServerInfo , handler grpc . UnaryHandler ) ( interface { } , error ) { interceptor := handler ui . lock . RLock ( ) for idx := len ( ui . interceptors ) - 1 ; idx >= 0 ; idx -- { interceptor = chainUnaryServerInterceptor ( ui . interceptors [ idx ] , info , interceptor ) } ui . lock . RUnlock ( ) return interceptor ( ctx , req ) } }
Interceptor chains all added interceptors into a single
`grpc.UnaryServerInterceptor`.
Interceptor chains all added interceptors into a single ` grpc . UnaryServerInterceptor ` .
// TODO: Find a more efficient way