示例#1
0
func initDB() {

	dbMgr = mongodb.NewDBManager()

	err := dbMgr.InitSession("mongodb://*****:*****@localhost,localhost/AMS") //TODO: Externalize the URL

	if err != nil {
		fmt.Println("DBManager init failed", err)
	} else {
		fmt.Println("DBManager Initialized")
	}
}
示例#2
0
func initDB() (err error) {

	dbMgr = mongodb.NewDBManager()

	err = dbMgr.InitSession(MONGODB_URL) //TODO: Externalize the URL

	if err != nil {
		err = errors.New("Unable to Conenct to the Database :" + err.Error())
	}

	return err
}
示例#3
0
func initDB() {

	dbMgr = mongodb.NewDBManager()

	err := dbMgr.InitSession("mongodb://localhost,localhost/test")

	if err != nil {
		fmt.Println("DBManager init failed", err)
	} else {
		fmt.Println("DBManager Initialized")
	}
}