-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
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
sqlite 驱动从 github.com/jinzhu/gorm/dialects/sqlite 改为 github.com/glebarez/go-sqlite #1626
Conversation
…rez/go-sqlite,以移除对 cgo 的依赖
这个变更挺大的,需要仔细 SQLite 下各项功能是否还正常工作。我之前也有留意到这个纯 go 的实现,但是似乎使用人数不是太高,所以一直没敢迁移。 |
刚想说问问要不要迁移, 现在 CGO 实现的对于交叉编译太不友好了. |
@@ -0,0 +1,288 @@ | |||
package model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没看懂为啥要包含这个文件,glebarez/go-sqlite 不是已经针对 gorm 做了兼容吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glebarez/go-sqlite 注册的驱动名是 "sqlite", mattn/go-sqlite3 注册的驱动名是 "sqlite3", jinzhu/gorm/dialect_sqlite3.go 里只写了 "sqlite3" 驱动名的支持;要支持 "sqlite" 这个驱动名,除了新加一个 dialect_sqlite,也没找到更优雅的方式做这个事情。go-gorm/gorm 已经对驱动依赖进行了剥离,如果条件允许我是推荐迁移到 go-gorm/gorm(工作量不小)
Thanks! This will be a huge improvement for cross-compiling! |
I need to revert this change because DB auto migration is broken. |
Fixed in 37cb292 |
sqlite 驱动从 github.com/jinzhu/gorm/dialects/sqlite 改为 github.com/glebarez/go-sqlite,以移除对 cgo 的依赖
TODO: 之前的 github.com/jinzhu/gorm 项目已经移至 github.com/go-gorm/gorm,并支持更多的特性