Documentation
¶
Index ¶
- func BadRequest(rw http.ResponseWriter, err error)
- func IPFromRequest(req *http.Request) net.IP
- func InternalServerError(rw http.ResponseWriter, err error)
- func Logging(req *http.Request, format string, args ...interface{})
- func SendEmptyJSON(rw http.ResponseWriter, code int)
- func SendFailure(rw http.ResponseWriter, format string, args ...interface{})
- func SendJSON(rw http.ResponseWriter, code int, data interface{})
- func SendResult(rw http.ResponseWriter, format string, args ...interface{})
- func SendSuccess(rw http.ResponseWriter)
- func Session(req *http.Request) *session.Session
- func UserID(req *http.Request) int64
- type Controller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func BadRequest(rw http.ResponseWriter, err error)
BadRequest sends a bad request message to the client.
func IPFromRequest ¶
IPFromRequest extracts the IP from the given request.
func InternalServerError ¶
func InternalServerError(rw http.ResponseWriter, err error)
InternalServerError sends an internal server error to the client.
func SendEmptyJSON ¶
func SendEmptyJSON(rw http.ResponseWriter, code int)
SendEmptyJSON sends an empty JSON document to the client.
func SendFailure ¶
func SendFailure(rw http.ResponseWriter, format string, args ...interface{})
SendFailure sends a failure message to the client.
func SendJSON ¶
func SendJSON(rw http.ResponseWriter, code int, data interface{})
SendJSON sends a JSON representation of the given data to the client.
func SendResult ¶
func SendResult(rw http.ResponseWriter, format string, args ...interface{})
SendResult sends result message to the client.
func SendSuccess ¶
func SendSuccess(rw http.ResponseWriter)
SendSuccess sends a common success message to the client.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller encapsulates the state known to all endpoints.
func (*Controller) BindRoutes ¶
func (c *Controller) BindRoutes(m *mux.Router)
BindRoutes binds all the the endpoints to the controller.
func (*Controller) Start ¶
func (c *Controller) Start() error
Start starts the logic of the controller running in background.
Click to show internal directories.
Click to hide internal directories.