Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(DBgorm *gorm.DB) *Controller
func (*Controller) GetFizzbuzzNumbers ¶
func (c *Controller) GetFizzbuzzNumbers(w http.ResponseWriter, r *http.Request)
Check parameters, call the service to get the fizzbuzz numbers list. Then the service is called to save the parameters in a MySQL database for further requesting.
Errors:
If one or more parameter is missing or incorrect, this method returns an error message with http error code 400 (Bad request).
func (*Controller) GetStatistics ¶
func (c *Controller) GetStatistics(w http.ResponseWriter, r *http.Request)
Call the service to get the most used parameters for the fizzbuzz numbers. It is possible to get multiples rows by calling this method.
Errors:
- Does not accept any parameter, if one or more parameter is provided, this method returns an error message with http error code 400 (Bad request).
- If there isn't at least one statistic row saved in database this method returns an error message with http error code 404 (Not found).