示例#1
0
文件: yunyun.go 项目: serash/YunYun
func GetMongoDB() *mgo.Database {
	datab, err := db.GetMongoDB()
	db.IfPanic(err)
	return datab
}
示例#2
0
文件: yunyun.go 项目: serash/YunYun
func GetKotobaCollection() *mgo.Collection {
	c, err := db.GetKotobaCollection()
	db.IfPanic(err)
	return c
}
示例#3
0
文件: auth.go 项目: serash/YunYun
func AddUser(db_ *mgo.Database, user string, email string, pass string) error {
	// insert user
	pwHash, err := bcrypt.GenerateFromPassword([]byte(pass), bcrypt.DefaultCost)
	db.IfPanic(err)
	return db.InsertUser(user, email, string(pwHash), db_)
}