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

表名未全部替换 #175

Open
5amch3n opened this issue Sep 4, 2024 · 0 comments
Open

表名未全部替换 #175

5amch3n opened this issue Sep 4, 2024 · 0 comments
Assignees

Comments

@5amch3n
Copy link

5amch3n commented Sep 4, 2024

我同时使用了 soft_delete,它在 where 中会加入 "表名.deleted_at = 0" 这样的条件,如

SELECT * FROM `t_box_file` WHERE (owner = 57 AND parent_id = 0 AND name like 'New Folder%') AND `t_box_file`.`deleted_at` = 0

sharding 只得到了这样的 sql:

SELECT * FROM `t_box_file_57` WHERE (owner = 57 AND parent_id = 0 AND name like 'New Folder%') AND `t_box_file`.`deleted_at` = 0

后面的表名没有被替换掉。

我只能临时添加了这一行来解决这个问题:

stQuery = strings.ReplaceAll(stQuery, "`"+tableName+"`.", "`"+newTable.Name.Name+"`.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants