Documentation ¶
Index ¶
- func CreateContext(ctx martini.Context, config *services.Config, conn *services.Connection, ...)
- func LoginForbidden(c Context)
- func LoginRequired(c Context)
- func RequiresValidSignature(c Context)
- func WebOnly(c Context)
- type Context
- func (c Context) AsyncQuery(fn func(*services.Connection))
- func (c Context) Count(colName string, query interface{}) (int, error)
- func (c Context) Error(status, code int, message string)
- func (c Context) Errors(status int, codes []int, messages []string)
- func (c Context) Find(colName string, where interface{}) *mgo.Query
- func (c Context) FindId(colName string, id interface{}) *mgo.Query
- func (c Context) Form(name string) string
- func (c Context) GetBoolean(key string) bool
- func (c Context) ListCountParams() (int, int)
- func (c Context) Query(colName string) *mgo.Collection
- func (c Context) Remove(colName string, selector interface{}) error
- func (c Context) RemoveAll(colName string, selector interface{}) (*mgo.ChangeInfo, error)
- func (c Context) RequestIsValid(isAccessKey bool) bool
- func (c Context) Success(status int, data map[string]interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateContext ¶
func CreateContext(ctx martini.Context, config *services.Config, conn *services.Connection, render render.Render, r *http.Request, s *sessions.CookieStore, ts *services.TaskService, rw http.ResponseWriter)
CreateContext initializes the context for a request
func LoginForbidden ¶
func LoginForbidden(c Context)
LoginForbidden returns an error if the user is logged in
func LoginRequired ¶
func LoginRequired(c Context)
LoginRequired returns an error if the user is not logged in
func RequiresValidSignature ¶
func RequiresValidSignature(c Context)
RequiresValidSignature returns an error if the request signature is not valid
Types ¶
type Context ¶
type Context struct { Config *services.Config Conn *services.Connection Request *http.Request Render render.Render Session *sessions.Session User *models.User Tasks *services.TaskService ResponseWriter http.ResponseWriter IsWebToken bool }
func (Context) AsyncQuery ¶
func (c Context) AsyncQuery(fn func(*services.Connection))
func (Context) GetBoolean ¶
func (Context) ListCountParams ¶
ListCountParams returns the count and offset parameters from the request
func (Context) Query ¶
func (c Context) Query(colName string) *mgo.Collection
Query returns a pointer to a collection
func (Context) RemoveAll ¶
func (c Context) RemoveAll(colName string, selector interface{}) (*mgo.ChangeInfo, error)
func (Context) RequestIsValid ¶
RequestIsValid returns if the current request signature is valid and thus is a valid request
Click to show internal directories.
Click to hide internal directories.