move protos to specical directory

This commit is contained in:
finlab
2021-01-16 16:08:05 +08:00
committed by huan li
parent c31772fd25
commit 65c0f57363
27 changed files with 3782 additions and 184 deletions

27
service/echo/v1/echo.go Normal file
View File

@@ -0,0 +1,27 @@
package echo
import (
"context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
pb "github.com/esinio/geco/gen/proto/echo/v1"
)
type Service struct {
*pb.UnimplementedEchoServiceServer
}
func (s *Service) Echo(ctx context.Context, req *pb.StringMessage) (*pb.StringMessage, error) {
if req.Value == "" {
return nil, status.Errorf(codes.Unimplemented, "value is empty")
}
return &pb.StringMessage{
Value: req.Value,
Timestamp: timestamppb.Now(),
}, nil
// return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented")
}