Created
July 11, 2017 07:40
-
-
Save leopard627/dabfa413823712850b26404849b37c50 to your computer and use it in GitHub Desktop.
Switch to another database:
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
| orm.RegisterDataBase("db1", "mysql", "root:root@/orm_db2?charset=utf8") | |
| orm.RegisterDataBase("db2", "sqlite3", "data.db") | |
| o1 := orm.NewOrm() | |
| o1.Using("db1") | |
| o2 := orm.NewOrm() | |
| o2.Using("db2") | |
| // After switching database | |
| // The API calls of this Ormer will use the new database |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment