Documentation ¶
Overview ¶
Package handlers provides the translation between the HTTP layer and application business logic.
Index ¶
- func AddPasteH(p *paste.Storage) gin.HandlerFunc
- func GetPasteH(p *paste.Storage) gin.HandlerFunc
- func KillPastesH(p *paste.Storage) gin.HandlerFunc
- func ListPastesH(p *paste.Storage) gin.HandlerFunc
- func PGCH(p *paste.Storage) gin.HandlerFunc
- func PingH(p *paste.Storage) gin.HandlerFunc
- func SchedulePGCCron(ps *paste.Storage)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPasteH ¶
func AddPasteH(p *paste.Storage) gin.HandlerFunc
AddPasteH godoc @Summary add a paste @Description add new paste @Accept json @Produce json @Success 200 {object} paste.Paste "new_paste" @Router /pastes [post] AddPasteH returns a handler that validates the body of a request to create a new paste.
func GetPasteH ¶
func GetPasteH(p *paste.Storage) gin.HandlerFunc
GetPasteH godoc @Summary finds a single paste identified by an ID in the request URL. @Description get paste by ID @ID get-string-by-int @Accept json @Produce json @Param id path string true "Paste ID" @Success 200 {object} paste.Paste "paste" @Router /pastes/{id} [get] GetPasteH returns a handler that finds a single paste identified by an ID in the request URL.
func KillPastesH ¶
func KillPastesH(p *paste.Storage) gin.HandlerFunc
KillPastesH godoc @Summary purges all pastes @Description returns empty slice for Pastes @Produce json @Success 200 {array} paste.Paste "pastes" @Router /pastes [delete] KillPastesH returns a handler that pugres all pastes by clearing the pastes list.
func ListPastesH ¶
func ListPastesH(p *paste.Storage) gin.HandlerFunc
ListPastesH godoc @Summary shows all pastes @Description get pastes list @Accept json @Produce json @Success 200 {array} paste.Paste "pastes" @Router /pastes [get] ListPastesH returns a handler that shows all pastes.
func PGCH ¶
func PGCH(p *paste.Storage) gin.HandlerFunc
PGCH godoc @Summary triggers obsolete data collection and removes it @Description returns count of the removed data @Produce json @Success 200 {array} int "gc" @Router /gc [get] PGCH returns a handler that triggers obsolete data collection.
func PingH ¶
func PingH(p *paste.Storage) gin.HandlerFunc
PingH godoc @Summary provides health checks @Description provides health checks @Accept json @Produce json @Success 200 {object} bool "OK" @Router /ping [get] GetPasteH returns a handler that provides health check
func SchedulePGCCron ¶
SchedulePGCCron schedules PGCRun() as cron job according to the GCSchedule.
Types ¶
This section is empty.