Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a requested record is not found.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller defines a metadata service controller.
func (*Controller) HealthCheck ¶
func (c *Controller) HealthCheck() *model.HealthStatus
HealthCheck returns the current health status of the application. It includes information such as the app version, start time, uptime, and a message indicating the application's health.
func (*Controller) SearchFighters ¶
func (c *Controller) SearchFighters(ctx context.Context, req *model.FightersRequest) ([]*model.Fighter, error)
SearchFighters retrieves fighters based on the provided request. It first retrieves the count of fighters to determine if any exist. If no fighters are found, it returns an empty list. Otherwise, it calls the repository's method to fetch the fighters and returns them. If an error occurs during the process, it logs the error and returns it.
func (*Controller) SearchFightersCount ¶
func (c *Controller) SearchFightersCount(ctx context.Context, req *model.FightersRequest) (int32, error)
SearchFightersCount retrieves the count of fighters based on the provided request. It calls the repository's method and returns the count. If an error occurs, it logs the error and returns it.
type FightersRepository ¶
type FightersRepository interface { pgxs.PickfighterRepo SearchFightersCount(ctx context.Context, req *model.FightersRequest) (int32, error) SearchFighters(ctx context.Context, req *model.FightersRequest) ([]*model.Fighter, error) FindFighter(ctx context.Context, req model.Fighter) (int32, error) CreateNewFighter(ctx context.Context, tx pgx.Tx, fighter model.Fighter) (int32, error) CreateNewFighterStats(ctx context.Context, tx pgx.Tx, stats model.FighterStats) error UpdateFighter(ctx context.Context, tx pgx.Tx, fighter model.Fighter) (int32, error) UpdateFighterStats(ctx context.Context, tx pgx.Tx, stats model.FighterStats) error }