func (self *repository) Operator(rc interface{}) *repositoryOperator { c := handy.CContext(rc) repo := c.GetFactory("mongo.repository." + self.collection) if repo != nil { return repo().(*repositoryOperator) } repository := &repositoryOperator{self, c, CCollection(rc, self.collection)} c.SetValue("mongo.repository."+self.collection, repository) return repository }
func SchemeDecoder(r interface{}) *schema.Decoder { return handy.CContext(r).Get("gorilla.schema").(*schema.Decoder) }
func SetCookie(r interface{}, k, v string) *http.Cookie { return handy.CContext(r).Get("cookies").(*Cookies).Set(k, v) }
func GetCookies(r interface{}) *Cookies { return handy.CContext(r).Get("cookies").(*Cookies) }
func Session(r interface{}) *sessions.Session { return handy.CContext(r).Get("session").(*sessions.Session) }
func HasCookie(r interface{}, k string) bool { return handy.CContext(r).Get("cookies").(*Cookies).Has(k) }
func GetCookie(r interface{}, k string) string { return handy.CContext(r).Get("cookies").(*Cookies).Get(k) }
func Defer(r interface{}, call func()) { handy.CContext(r).Get("defer").(r_defer) <- call }