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} }
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} }
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) } } }