Example #1
0
func newTable(mydb *db.DB, name string) *KvTable {
	if err := mydb.Create(name); err != nil {
		log.Println(err)
	}
	//	mydb.Scrub(name)
	myTable := mydb.Use(name)
	return &KvTable{name: name, col: myTable, tdb: mydb}
}
Example #2
0
func NewGenericRepository(database *db.DB, coll string) GenericRepository {
	col := database.Use(coll)
	if col == nil {
		err := database.Create(coll)
		if err != nil {
			panic(err)
		}

		col = database.Use(coll)
	}

	return GenericRepository{database, coll}
}
Example #3
0
func initDatabase(database *db.DB) {
	col := database.Use("Settings")
	if col == nil {
		err := database.Create("Settings")
		if err != nil {
			panic(err)
		}
	}

	col = database.Use("Scripts")
	if col == nil {
		err := database.Create("Scripts")
		if err != nil {
			panic(err)
		}
	}
}