调用同一个api3次, 都是查询同一个数据 第一次: [101.228ms] [rows:1] SELECT * FROM oneos_project WHERE oneos_project.project_id = '1481247086404964352' AND oneos_project.deleted = 0 ORDER BY oneos_project.project_id LIMIT 1 第二次: [84.169ms] [rows:1] SELECT * FROM oneos_project WHERE oneos_project.project_id = '1481247086404964352' AND oneos_project.deleted = 0 AND oneos_project.project_id = '1481247086404964352' ORDER BY oneos_project.project_id,oneos_project.project_id LIMIT 1 第三次: [115.125ms] [rows:1] SELECT * FROM oneos_project WHERE oneos_project.project_id = '1481247086404964352' AND oneos_project.deleted = 0 AND oneos_project.project_id = '1481247086404964352' AND oneos_project.project_id = '1481247086404964352' ORDER BY oneos_project.project_id,oneos_project.project_id,oneos_project.project_id LIMIT 1

会发现 oneos_project.project_id = '1481247086404964352' 不停的重复累加

其实调用里面的任意一个增删改查方法,这个条件都会累加,在 v1 就没这个问题,升到v2 就出问题。 是有bug么

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: ghost

可以看下这个: https://gorm.cn/zh_CN/docs/method_chaining.html gorm v2 会复用 statement.

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: FarmerChillax

这个问题有什么好的解决方法吗?

可以看下这个: https://gorm.cn/zh_CN/docs/method_chaining.html gorm v2 会复用 statement.

我在从 v1 -> v2 的过程中,也遇到了这个问题。我有什么办法将这个复用关闭吗?我希望能达到 v1 的效果。