Created
September 29, 2018 06:43
-
-
Save ipv4sec/8be0fe6bcddedbc4aa890d674ad1a49d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var GetMasterDb = func() *sqlx.DB { | |
| masterOnce.Do(func() { | |
| var err error | |
| conf := base.GetConfig() | |
| args := fmt.Sprintf( | |
| "%v:%v@tcp(%v:%v)/%v", | |
| conf.Mysql.Master.User, | |
| conf.Mysql.Master.Pass, | |
| conf.Mysql.Master.Host, | |
| conf.Mysql.Master.Port, | |
| conf.Mysql.Master.Db) | |
| logger.Info("mysql args:", args) | |
| masterDb, err = sqlx.Open("mysql", args) | |
| if err != nil { | |
| panic(err.Error()) | |
| } | |
| }) | |
| return masterDb | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment