controller

package
v0.0.0-...-d16d13b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

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).

type QueryParam

type QueryParam struct {
	Limit string `validate:"required,numeric"`
	Int1  string `validate:"required,numeric"`
	Int2  string `validate:"required,numeric"`
	Str1  string `validate:"required,alphanum,max=64"`
	Str2  string `validate:"required,alphanum,max=64"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL