Skip to content

Commit

Permalink
Refresh selected db after query
Browse files Browse the repository at this point in the history
  • Loading branch information
lewissteele committed Dec 14, 2024
1 parent 8085b43 commit c355c88
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/db/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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

Expand Down

0 comments on commit c355c88

Please sign in to comment.