diff --git a/internal/db/user.go b/internal/db/user.go index a1b1fb9..e5d3924 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -80,6 +80,8 @@ func Query(q string) ([]map[string]interface{}, error) { var results []map[string]interface{} err := Conn.Raw(q).Scan(&results).Error + go updateSelected() + return results, err } @@ -90,6 +92,11 @@ func Port(d Driver) string { return "3306" } +func updateSelected() { + UserDB.Database = Selected() + LocalDB.Save(UserDB) +} + func dialector(u model.Database) gorm.Dialector { var dialector gorm.Dialector