Documentation
¶
Index ¶
- func LogCtxUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func NewServerError(err error) error
- func RunServer(ctx context.Context, log logrus.FieldLogger, ...) error
- func TraceIDUnaryServerInterceptor() grpc.UnaryServerInterceptor
- type Server
- func (s *Server) CancelReservation(ctx context.Context, req *bikerentalv1.CancelReservationRequest) (*empty.Empty, error)
- func (s *Server) CreateBike(ctx context.Context, req *bikerentalv1.CreateBikeRequest) (*bikerentalv1.Bike, error)
- func (s *Server) CreateReservation(ctx context.Context, req *bikerentalv1.CreateReservationRequest) (*bikerentalv1.CreateReservationResponse, error)
- func (s *Server) DeleteBike(ctx context.Context, req *bikerentalv1.DeleteBikeRequest) (*empty.Empty, error)
- func (s *Server) GetBike(ctx context.Context, req *bikerentalv1.GetBikeRequest) (*bikerentalv1.Bike, error)
- func (s *Server) GetBikeAvailability(ctx context.Context, req *bikerentalv1.GetBikeAvailabilityRequest) (*bikerentalv1.GetBikeAvailabilityResponse, error)
- func (s *Server) ListBikes(ctx context.Context, _ *empty.Empty) (*bikerentalv1.ListBikesResponse, error)
- func (s *Server) ListReservations(ctx context.Context, req *bikerentalv1.ListReservationsRequest) (*bikerentalv1.ListReservationsResponse, error)
- func (s *Server) UpdateBike(ctx context.Context, req *bikerentalv1.UpdateBikeRequest) (*empty.Empty, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogCtxUnaryServerInterceptor ¶
func LogCtxUnaryServerInterceptor() grpc.UnaryServerInterceptor
LogCtxUnaryServerInterceptor returns a new unary server interceptor adding request information to context for logging.
func NewServerError ¶
NewServerError creates error for server response.
func RunServer ¶
func RunServer( ctx context.Context, log logrus.FieldLogger, srv bikerentalv1.BikeRentalServiceServer, lis net.Listener, ) error
RunServer starts grpc server with ServiceServer service. Server is gracefully shut down on context cancellation.
func TraceIDUnaryServerInterceptor ¶
func TraceIDUnaryServerInterceptor() grpc.UnaryServerInterceptor
TraceIDUnaryServerInterceptor returns a new unary server interceptor for generating trace id.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements rpc ServiceServer.
func NewServer ¶
func NewServer( bikeService bikerental.BikeService, reservationService bikerental.ReservationService, log logrus.FieldLogger, ) (*Server, error)
NewServer creates new Server instance.
func (*Server) CancelReservation ¶
func (s *Server) CancelReservation(ctx context.Context, req *bikerentalv1.CancelReservationRequest) (*empty.Empty, error)
CancelReservation cancels reservation for a bike.
func (*Server) CreateBike ¶
func (s *Server) CreateBike(ctx context.Context, req *bikerentalv1.CreateBikeRequest) (*bikerentalv1.Bike, error)
CreateBike creates new bike.
func (*Server) CreateReservation ¶
func (s *Server) CreateReservation(ctx context.Context, req *bikerentalv1.CreateReservationRequest) (*bikerentalv1.CreateReservationResponse, error)
CreateReservation creates new reservation. Returns created object with new id.
func (*Server) DeleteBike ¶
func (s *Server) DeleteBike(ctx context.Context, req *bikerentalv1.DeleteBikeRequest) (*empty.Empty, error)
DeleteBike deletes a bike.
func (*Server) GetBike ¶
func (s *Server) GetBike(ctx context.Context, req *bikerentalv1.GetBikeRequest) (*bikerentalv1.Bike, error)
GetBike returns a bike.
func (*Server) GetBikeAvailability ¶
func (s *Server) GetBikeAvailability(ctx context.Context, req *bikerentalv1.GetBikeAvailabilityRequest) (*bikerentalv1.GetBikeAvailabilityResponse, error)
GetBikeAvailability checks bike availability in given time ranges.
func (*Server) ListBikes ¶
func (s *Server) ListBikes(ctx context.Context, _ *empty.Empty) (*bikerentalv1.ListBikesResponse, error)
ListBikes returns list of all bikes.
func (*Server) ListReservations ¶
func (s *Server) ListReservations(ctx context.Context, req *bikerentalv1.ListReservationsRequest) (*bikerentalv1.ListReservationsResponse, error)
ListReservations returns list of reservations for a bike.
func (*Server) UpdateBike ¶
func (s *Server) UpdateBike(ctx context.Context, req *bikerentalv1.UpdateBikeRequest) (*empty.Empty, error)
UpdateBike updates a bike.