Skip to content
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

考虑支持postgresql? #3

Closed
sb-child opened this issue Jul 17, 2021 · 7 comments
Closed

考虑支持postgresql? #3

sb-child opened this issue Jul 17, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@sb-child
Copy link

sb-child commented Jul 17, 2021

相比mysql, postgresql在很多方面有着更大的优势

@yedf2
Copy link
Contributor

yedf2 commented Jul 18, 2021

这个在计划中,目前dtm仅仅依赖了gorm,不依赖底层具体是什么数据库。
后续会在postgresql上面做测试,给出示例

@yedf2 yedf2 added the enhancement New feature or request label Jul 20, 2021
@yedf2
Copy link
Contributor

yedf2 commented Aug 1, 2021

您好,这两天研究了一下postgresql的支持,结论是要想做到同时支持mysql和postgresql,那么就得把所有的sql,用多数据库支持的orm,这回导致dtm的客户端很重,预计不会那么快去做这方面的工作。

dtm的服务端使用了gorm,支持postgres,目前我在dtm加了postgres分支,这个分支下,能够跑通saga的例子。

@XIELongDragon
Copy link

您好,这两天研究了一下postgresql的支持,结论是要想做到同时支持mysql和postgresql,那么就得把所有的sql,用多数据库支持的orm,这回导致dtm的客户端很重,预计不会那么快去做这方面的工作。

dtm的服务端使用了gorm,支持postgres,目前我在dtm加了postgres分支,这个分支下,能够跑通saga的例子。

是否可以考虑使用github.com/doug-martin/goqu 这样更轻量级的包而不是厚重的orm?

@yedf2
Copy link
Contributor

yedf2 commented Aug 11, 2021

@XIELongDragon 对于dtm服务器来说,用gorm的代价还好,反正一个服务,最后生成的文件不大。dtmcli是单独拆出来的包,不依赖gorm的,对使用dtm的程序来说,不会因为dtm,引入gorm
看了你推荐的库,貌似没有对高级功能例如insert ignore的支持,而dtm用到了

@XIELongDragon
Copy link

XIELongDragon commented Aug 11, 2021

insert ignore你是指记录如果存在就skip吗?有呀

                           tx.
				Insert(yourTable).
				Rows(yourData).
				OnConflict(goqu.DoNothing()).
				Executor().
				Exec()

还是指某些field在插入是应该忽略?也是有的

type MyData struct {
    ID            uint64 `db:"id" goqu:"skipinsert,skipupdate"`
}

@yedf2
Copy link
Contributor

yedf2 commented Aug 11, 2021

收到,这个留待后续优化,或者社区有人帮忙做了这个事情,可以合并进来

@yedf2
Copy link
Contributor

yedf2 commented Oct 16, 2021

@sb-child postgresql已完整支持 https://dtm.pub/character/supported-db.html

@yedf2 yedf2 closed this as completed Oct 16, 2021
yedf2 added a commit that referenced this issue Mar 29, 2022
docs: add explicit comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants