1
0
Эх сурвалжийг харах

export AddOptions, AddStreamInterceptors, AddUnaryInterceptors

kevin 4 жил өмнө
parent
commit
bc831b75dd
1 өөрчлөгдсөн 13 нэмэгдсэн , 0 устгасан
  1. 13 0
      zrpc/server.go

+ 13 - 0
zrpc/server.go

@@ -13,6 +13,7 @@ import (
 	"github.com/tal-tech/go-zero/zrpc/internal"
 	"github.com/tal-tech/go-zero/zrpc/internal"
 	"github.com/tal-tech/go-zero/zrpc/internal/auth"
 	"github.com/tal-tech/go-zero/zrpc/internal/auth"
 	"github.com/tal-tech/go-zero/zrpc/internal/serverinterceptors"
 	"github.com/tal-tech/go-zero/zrpc/internal/serverinterceptors"
+	"google.golang.org/grpc"
 )
 )
 
 
 const envPodIp = "POD_IP"
 const envPodIp = "POD_IP"
@@ -65,6 +66,18 @@ func NewServer(c RpcServerConf, register internal.RegisterFn) (*RpcServer, error
 	return rpcServer, nil
 	return rpcServer, nil
 }
 }
 
 
+func (rs *RpcServer) AddOptions(options ...grpc.ServerOption) {
+	rs.AddOptions(options...)
+}
+
+func (rs *RpcServer) AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) {
+	rs.AddStreamInterceptors(interceptors...)
+}
+
+func (rs *RpcServer) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) {
+	rs.AddUnaryInterceptors(interceptors...)
+}
+
 func (rs *RpcServer) Start() {
 func (rs *RpcServer) Start() {
 	if err := rs.server.Start(rs.register); err != nil {
 	if err := rs.server.Start(rs.register); err != nil {
 		logx.Error(err)
 		logx.Error(err)