We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题:在orm.go 文件中,如何优雅的配置,连接多数据库,读写分离,求解 场景:在生产环境,会出现读写分离,多数据库场景 1、db_user库下user表 2、db_order库下order表
请教一下,希望得到解答
The text was updated successfully, but these errors were encountered:
关于连接多数据库有两种解决方案: 1、db_user和db_order在配置上分开,然后通过orm.NewMySQL来实例化到两个全局变量上,最后分开调用即可; 2、封装两个方法,例如 orm.Init() 和 orm.Get(), orm.Init() 支持初始化多个数据库,内部放入到全局map里,orm.Get() 获取时从map获取db实例 目前是第一种可以直接使用,第二种需要做一层简单封装,现在框架还没做这一块。 @webff
orm.Init()
orm.Get()
Sorry, something went wrong.
目前已经支持 多数据库配置。
No branches or pull requests
问题:在orm.go 文件中,如何优雅的配置,连接多数据库,读写分离,求解
场景:在生产环境,会出现读写分离,多数据库场景
1、db_user库下user表
2、db_order库下order表
请教一下,希望得到解答
The text was updated successfully, but these errors were encountered: