Example #1
0
func One() martini.Handler {
	return func(r render.Render, params martini.Params) {
		bucket, err := db.FindByName(params["name"])
		if err != nil {
			comm.JsonErr(r, err)
		} else {
			comm.JsonContent(r, bucket)
		}
	}
}
Example #2
0
func Save() martini.Handler {
	return func(data db.Bucket, r render.Render) {
		err := DB.Save(&data).Error
		if err != nil {
			comm.JsonErr(r, err)
		} else {
			initBuckets()
			comm.JsonContent(r, &data)
		}
	}
}
Example #3
0
func List() martini.Handler {
	return func(r render.Render) {
		comm.JsonContent(r, Buckets())
	}
}
Example #4
0
func NameList() martini.Handler {
	return func(r render.Render) {
		comm.JsonContent(r, Names())
	}
}