Skip to content

Commit

Permalink
Feat: add grpc provider reference in codes generated by protoc-gen-du…
Browse files Browse the repository at this point in the history
…bbo3 (#1240)

* fix: change 3.0 triple provider reference

* fix: change 3.0 triple provider reference

* Fix: add liscence
  • Loading branch information
LaurenceLiZhixin authored Jun 7, 2021
1 parent b5cd555 commit 3e881f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions protocol/dubbo3/protoc-gen-dubbo3/examples/helloworld.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions protocol/dubbo3/protoc-gen-dubbo3/plugin/dubbo3/dubbo3.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ func (g *dubboGrpc) generateService(file *generator.FileDescriptor, service *pb.
g.P("}")
g.P()

// return reference
g.P("func (c *", serverType, ") ", " Reference() string ", "{")
g.P(`return "`, unexport(servName), `Impl"`)
g.P("}")
g.P()

// add handler
var handlerNames []string
for _, method := range service.Method {
Expand Down
6 changes: 6 additions & 0 deletions protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ func (g *dubboGrpc) generateService(file *generator.FileDescriptor, service *pb.
g.P("}")
g.P()

// return reference
g.P("func (c *", serverType, ") ", " Reference() string ", "{")
g.P(`return "`, unexport(servName), `Impl"`)
g.P("}")
g.P()

// add handler
var handlerNames []string
for _, method := range service.Method {
Expand Down

0 comments on commit 3e881f6

Please sign in to comment.