server.tmpl 717 B

12345678910111213141516171819202122232425262728293031
  1. // Package server generate by warden_gen
  2. package server
  3. import (
  4. {{range $key, $value := .Imports}}"{{$key}}"{{end}}
  5. service "{{.RecvPackage}}"
  6. pb "{{.PbPackage}}"
  7. "go-common/library/net/rpc/warden"
  8. )
  9. // New {{.Name}} warden rpc server
  10. func New(c *warden.ServerConfig, svr *service.{{.RecvName}}) (*warden.Server) {
  11. ws := warden.NewServer(c)
  12. pb.Register{{.Name}}Server(ws.Server(), &server{svr})
  13. return ws
  14. }
  15. type server struct {
  16. svr *service.{{.RecvName}}
  17. }
  18. var _ pb.{{.Name}}Server = &server{}
  19. {{range .Methods}}
  20. // {{range .Comments}}{{.}}{{end}}
  21. func(s *server) {{.Name}}(ctx context.Context, req *pb.{{.Name}}Req) (*pb.{{.Name}}Reply, error) {
  22. panic("not implemented")
  23. }
  24. {{end}}