Documentation
¶
Index ¶
- Variables
- func Car(w http.ResponseWriter, r *http.Request)
- func CarInfo(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func Cars(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func Departments(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func ErrorHandler(fn func(http.ResponseWriter, *http.Request) (int, error)) http.HandlerFunc
- func GetHandler(addon []Route, middlewares ...func(http.HandlerFunc) http.HandlerFunc) (*mux.Router, http.Handler)
- func GetRoutes(db storage.Storage) *mux.Router
- func Index(w http.ResponseWriter, r *http.Request)
- func JSONHandler(next func(http.ResponseWriter, *http.Request) (interface{}, int, error)) http.HandlerFunc
- func Rent(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func RentJournal(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func Return(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func Stats(w http.ResponseWriter, r *http.Request)
- func StatsByModel(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func StatsByType(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func Tracking(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- func TrackingExp(w http.ResponseWriter, r *http.Request) (interface{}, int, error)
- type RentData
- type Route
Constants ¶
This section is empty.
Variables ¶
View Source
var Routes = []Route{ { IsAPI: true, Path: "/cars", Methods: []string{"GET"}, Handler: JSONHandler(Cars), }, { IsAPI: true, Path: "/car/{rn}", Methods: []string{"GET"}, Handler: JSONHandler(CarInfo), }, { IsAPI: true, Path: "/departments", Methods: []string{"GET"}, Handler: JSONHandler(Departments), }, { IsAPI: true, Path: "/stats/deps/model", Methods: []string{"GET"}, Handler: JSONHandler(StatsByModel), }, { IsAPI: true, Path: "/stats/deps/type", Methods: []string{"GET"}, Handler: JSONHandler(StatsByType), }, { IsAPI: true, Path: "/rent", Methods: []string{"POST"}, Handler: JSONHandler(Rent), }, { IsAPI: true, Path: "/return", Methods: []string{"POST"}, Handler: JSONHandler(Return), }, { IsAPI: true, Path: "/rentjournal", Methods: []string{"GET"}, Handler: JSONHandler(RentJournal), }, { IsAPI: true, Path: "/rentjournal/{rn}", Methods: []string{"GET"}, Handler: JSONHandler(RentJournal), }, { IsAPI: true, Path: "/track/{car}/{x}/{y}", Methods: []string{"PUT"}, Handler: JSONHandler(Tracking), }, { IsAPI: true, Path: "/trackexp/{car}/{x}/{y}", Methods: []string{"PUT"}, Handler: JSONHandler(TrackingExp), }, { IsAPI: false, Path: "/", Methods: []string{"GET"}, Handler: Index, }, { IsAPI: false, Path: "/car", Methods: []string{"GET"}, Handler: Car, }, { IsAPI: false, Path: "/stats", Methods: []string{"GET"}, Handler: Stats, }, { IsAPI: false, Path: "/car/{rn}", Methods: []string{"GET"}, Handler: Car, }, }
Routes - web appication routes
Functions ¶
func Car ¶
func Car(w http.ResponseWriter, r *http.Request)
Car - обработчик для страницы /car просмотр истории и действия с ТС
func Departments ¶
Departments - handler for api. Returns list of the departments
func ErrorHandler ¶
func ErrorHandler(fn func(http.ResponseWriter, *http.Request) (int, error)) http.HandlerFunc
ErrorHandler - returns error in json
func GetHandler ¶
func GetHandler(addon []Route, middlewares ...func(http.HandlerFunc) http.HandlerFunc) (*mux.Router, http.Handler)
func Index ¶
func Index(w http.ResponseWriter, r *http.Request)
Index - /index Стартовая страница просмотр истории проката автомобилей
func JSONHandler ¶
func JSONHandler(next func(http.ResponseWriter, *http.Request) (interface{}, int, error)) http.HandlerFunc
JSONHandler - returns response in json or error
func RentJournal ¶
RentJournal - handler for api. Returns list of the rental cars
func Stats ¶
func Stats(w http.ResponseWriter, r *http.Request)
Stats - обработчик для страницы просмотра статистики
func StatsByModel ¶
TODO: test StatsByModel
func StatsByType ¶
TODO: test StatsByType
func TrackingExp ¶
Exp1: Tracking Handler для трекинга ТС
Types ¶
Click to show internal directories.
Click to hide internal directories.