Documentation ¶
Index ¶
- func BuildWebServer(db string, daoType int, statisticsDuration time.Duration) (*negroni.Negroni, error)
- type Route
- type Router
- type SpiritHandler
- func (sh *SpiritHandler) Create(w http.ResponseWriter, r *http.Request)
- func (sh *SpiritHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (sh *SpiritHandler) Get(w http.ResponseWriter, r *http.Request)
- func (sh *SpiritHandler) GetAll(w http.ResponseWriter, r *http.Request)
- func (sh *SpiritHandler) Update(w http.ResponseWriter, r *http.Request)
- type StatisticsMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
Route is a structure of Route
type Router ¶
Router is the struct use for routing
func NewRouter ¶
func NewRouter(handler *SpiritHandler) *Router
NewRouter creates a new router instance
type SpiritHandler ¶
type SpiritHandler struct { Routes []Route Prefix string // contains filtered or unexported fields }
SpiritHandler is a handler of spirits
func NewSpiritHandler ¶
func NewSpiritHandler(spiritDAO dao.SpiritDAO) *SpiritHandler
NewSpiritHandler creates a new spirit handler to manage spirits
func (*SpiritHandler) Create ¶
func (sh *SpiritHandler) Create(w http.ResponseWriter, r *http.Request)
Create create an entity
func (*SpiritHandler) Delete ¶
func (sh *SpiritHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete delete an entity by id
func (*SpiritHandler) Get ¶
func (sh *SpiritHandler) Get(w http.ResponseWriter, r *http.Request)
Get retrieve an entity by id
func (*SpiritHandler) GetAll ¶
func (sh *SpiritHandler) GetAll(w http.ResponseWriter, r *http.Request)
GetAll retrieve all entities with optional paging of items (start / end are item counts 50 to 100 for example)
func (*SpiritHandler) Update ¶
func (sh *SpiritHandler) Update(w http.ResponseWriter, r *http.Request)
Update update an entity by id
type StatisticsMiddleware ¶
type StatisticsMiddleware struct {
Stat *utils.Statistics
}
StatisticsMiddleware is the middleware to record request statistics
func NewStatisticsMiddleware ¶
func NewStatisticsMiddleware(duration time.Duration) *StatisticsMiddleware
NewStatisticsMiddleware creates a new statistics middleware
func (*StatisticsMiddleware) ServeHTTP ¶
func (sm *StatisticsMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Click to show internal directories.
Click to hide internal directories.