update server
This commit is contained in:
@@ -12,8 +12,21 @@ service ${REPO_NAME_PASCAL} {
|
|||||||
get: "/api/ping"
|
get: "/api/ping"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
rpc Echo(EchoReq) returns (EchoRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/api/echo"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message PingReq {}
|
message PingReq {}
|
||||||
|
|
||||||
message PingRsp {}
|
message PingRsp {}
|
||||||
|
|
||||||
|
message EchoReq {
|
||||||
|
string text = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EchoRsp {
|
||||||
|
string text = 1;
|
||||||
|
}
|
||||||
|
|||||||
+10
-6
@@ -1,18 +1,22 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "${REPO_NAME_SNAKE}/proto"
|
|
||||||
"context"
|
"context"
|
||||||
|
proto "${REPO_NAME_SNAKE}/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type server struct {
|
||||||
proto.Unimplemented${REPO_NAME_PASCAL}Server
|
proto.Unsafe{REPO_NAME_PASCAL}Server
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServer() *Server {
|
func NewServer() proto.TestTemplateRepoServer {
|
||||||
return &Server{}
|
return &server{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Ping(_ context.Context, _ *proto.PingReq) (*proto.PingRsp, error) {
|
func (s *server) Ping(_ context.Context, _ *proto.PingReq) (*proto.PingRsp, error) {
|
||||||
return &proto.PingRsp{}, nil
|
return &proto.PingRsp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *server) Echo(_ context.Context, req *proto.EchoReq) (*proto.EchoRsp, error) {
|
||||||
|
return &proto.EchoRsp{Text: req.Text}, nil
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user