How to dynamically route traffic to different databases?
dsn := “user:pass@tcp(127.0.0.1:3306)/testDB?charset=utf8mb4&parseTime=True&loc=Local” db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{}) if err != nil { panic(“failed to connect database”) } Now that there is a db object in the project, how can we route the read and write traffic of this db object to the new database at the bottom layer of gorm? The goal is to […]