Documentation ¶
Index ¶
- Constants
- func Auth(options *AuthOptions) macaron.Handler
- func GetContextHandler() macaron.Handler
- func Gziper() macaron.Handler
- func Logger() macaron.Handler
- func MeasureRequestTime() macaron.Handler
- func Quota(target string) macaron.Handler
- func QuotaReached(c *Context, target string) (bool, error)
- func Recovery() macaron.Handler
- func RoleAuth(roles ...m.RoleType) macaron.Handler
- func Sessioner(options *session.Options) macaron.Handler
- func ValidateHostHeader(domain string) macaron.Handler
- type AuthOptions
- type Context
- func (ctx *Context) Handle(status int, title string, err error)
- func (ctx *Context) HasUserRole(role m.RoleType) bool
- func (ctx *Context) IsApiRequest() bool
- func (ctx *Context) JsonApiErr(status int, message string, err error)
- func (ctx *Context) JsonOK(message string)
- func (ctx *Context) TimeRequest(timer metrics.Timer)
- type SessionStore
- type SessionWrapper
Constants ¶
View Source
const ( SESS_KEY_USERID = "uid" SESS_KEY_APIKEY = "apikey_id" // used fror render requests with api keys )
Variables ¶
This section is empty.
Functions ¶
func Auth ¶
func Auth(options *AuthOptions) macaron.Handler
func GetContextHandler ¶
func GetContextHandler() macaron.Handler
func MeasureRequestTime ¶ added in v3.1.0
func MeasureRequestTime() macaron.Handler
func Recovery ¶ added in v3.1.0
func Recovery() macaron.Handler
Recovery returns a middleware that recovers from any panics and writes a 500 if there was one. While Martini is in development mode, Recovery will also output the panic as HTML.
func ValidateHostHeader ¶
func ValidateHostHeader(domain string) macaron.Handler
Types ¶
type AuthOptions ¶
type Context ¶
type Context struct { *macaron.Context *m.SignedInUser Session SessionStore IsSignedIn bool AllowAnonymous bool Logger log.Logger }
func (*Context) IsApiRequest ¶
func (*Context) TimeRequest ¶ added in v3.1.0
type SessionStore ¶
type SessionStore interface { // Set sets value to given key in session. Set(interface{}, interface{}) error // Get gets value by given key in session. Get(interface{}) interface{} // ID returns current session ID. ID() string // Release releases session resource and save data to provider. Release() error // Destory deletes a session. Destory(*Context) error // init Start(*Context) error }
func GetSession ¶
func GetSession() SessionStore
type SessionWrapper ¶
type SessionWrapper struct {
// contains filtered or unexported fields
}
func (*SessionWrapper) Destory ¶
func (s *SessionWrapper) Destory(c *Context) error
func (*SessionWrapper) Get ¶
func (s *SessionWrapper) Get(k interface{}) interface{}
func (*SessionWrapper) ID ¶
func (s *SessionWrapper) ID() string
func (*SessionWrapper) Release ¶
func (s *SessionWrapper) Release() error
func (*SessionWrapper) Set ¶
func (s *SessionWrapper) Set(k interface{}, v interface{}) error
func (*SessionWrapper) Start ¶
func (s *SessionWrapper) Start(c *Context) error
Click to show internal directories.
Click to hide internal directories.