Documentation
¶
Index ¶
- type FightersController
- type Handler
- func (h *Handler) HealthCheck(ctx context.Context, req *emptypb.Empty) (*gen.HealthResponse, error)
- func (h *Handler) SearchFighters(ctx context.Context, req *gen.FightersRequest) (*gen.FightersResponse, error)
- func (h *Handler) SearchFightersCount(ctx context.Context, req *gen.FightersRequest) (*gen.FightersCountResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FightersController ¶
type FightersController interface {
SearchFightersCount(ctx context.Context, req *model.FightersRequest) (int32, error)
SearchFighters(ctx context.Context, req *model.FightersRequest) ([]*model.Fighter, error)
HealthCheck() *model.HealthStatus
}
type Handler ¶
type Handler struct {
gen.UnimplementedFightersServiceServer
// contains filtered or unexported fields
}
Handler defines a Fighters gRPC handler.
func (*Handler) HealthCheck ¶
HealthCheck handles the gRPC request for checking the health status of the application. It delegates the call to the controller and converts the result into a protobuf response.
func (*Handler) SearchFighters ¶
func (h *Handler) SearchFighters(ctx context.Context, req *gen.FightersRequest) (*gen.FightersResponse, error)
SearchFighters retrieves fighters based on the provided request. It converts the request to the internal model, calls the controller's method, and returns the response. If no fighters are found, it returns a NotFound error; otherwise, it returns the list of fighters.
func (*Handler) SearchFightersCount ¶
func (h *Handler) SearchFightersCount(ctx context.Context, req *gen.FightersRequest) (*gen.FightersCountResponse, error)
SearchFightersCount retrieves the count of fighters based on the provided request. It converts the request to the internal model, calls the controller's method, and returns the count.