Example #1
0
func GetMongoDB() *mgo.Database {
	datab, err := db.GetMongoDB()
	db.IfPanic(err)
	return datab
}
Example #2
0
func GetKotobaCollection() *mgo.Collection {
	c, err := db.GetKotobaCollection()
	db.IfPanic(err)
	return c
}
Example #3
0
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_)
}