Skip to content

fix: batch update categories #186

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

Merged
merged 1 commit into from
Mar 11, 2023
Merged

fix: batch update categories #186

merged 1 commit into from
Mar 11, 2023

Conversation

jakezhu9
Copy link
Member

fix #184

Now we're able to save a list of categories without any errors.

I replaced the original 'Save' with 'Updates' because the former wasn't able to handle 'create_time' and 'update_time' properly, even if they were manually specified. It required more SQL statements to execute, but the result is definitely worth it.

@1379
Copy link
Contributor

1379 commented Mar 10, 2023

Is it a better choice to find out all the data in batches, then update the data fields found, and then save?

@1379
Copy link
Contributor

1379 commented Mar 10, 2023

Is it a better choice to find out all the data in batches, then update the data fields found, and then save?

Writing like this is not elegant,However, it can reduce the number of times to execute sql.

I don't know which of the two methods to choose. What's your opinion

@jakezhu9
Copy link
Member Author

Is it a better choice to find out all the data in batches, then update the data fields found, and then save?

I don't think this is the best option. Like you mentioned, the code is not elegant. Generally, users don't update categories frequently and there aren't too many categories. It has little impact on performance so we don't need to write complex code to optimize it.

I also tried finding other ways to reduce the sql statement, but they either difficult to maintain or too complex. If you have any better ideas, please let me know!

@1379
Copy link
Contributor

1379 commented Mar 11, 2023

I think you are right

@1379
Copy link
Contributor

1379 commented Mar 11, 2023

Please use rebase instead of merge

@jakezhu9 jakezhu9 merged commit 7db85af into go-sonic:master Mar 11, 2023
@jakezhu9
Copy link
Member Author

Done👌

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

Successfully merging this pull request may close these issues.

后台分类列表中点击保存提示内部错误
2 participants