示例#1
0
文件: repository.go 项目: W3SS/mongo
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
}
示例#2
0
文件: schema.go 项目: W3SS/handy
func SchemeDecoder(r interface{}) *schema.Decoder {
	return handy.CContext(r).Get("gorilla.schema").(*schema.Decoder)
}
示例#3
0
文件: sessions.go 项目: W3SS/handy
func SetCookie(r interface{}, k, v string) *http.Cookie {
	return handy.CContext(r).Get("cookies").(*Cookies).Set(k, v)
}
示例#4
0
文件: sessions.go 项目: W3SS/handy
func GetCookies(r interface{}) *Cookies {
	return handy.CContext(r).Get("cookies").(*Cookies)
}
示例#5
0
文件: sessions.go 项目: W3SS/handy
func Session(r interface{}) *sessions.Session {
	return handy.CContext(r).Get("session").(*sessions.Session)
}
示例#6
0
文件: sessions.go 项目: W3SS/handy
func HasCookie(r interface{}, k string) bool {
	return handy.CContext(r).Get("cookies").(*Cookies).Has(k)
}
示例#7
0
文件: sessions.go 项目: W3SS/handy
func GetCookie(r interface{}, k string) string {
	return handy.CContext(r).Get("cookies").(*Cookies).Get(k)
}
示例#8
0
文件: defer.go 项目: W3SS/handy
func Defer(r interface{}, call func()) {
	handy.CContext(r).Get("defer").(r_defer) <- call
}