move protos to specical directory
This commit is contained in:
27
service/echo/v1/echo.go
Normal file
27
service/echo/v1/echo.go
Normal 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")
|
||||
}
|
||||
Reference in New Issue
Block a user