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

[Question] Generated SQL not correct for Update Selected Fields #745

Open
zhangyangyu opened this issue Mar 13, 2024 · 0 comments
Open

[Question] Generated SQL not correct for Update Selected Fields #745

zhangyangyu opened this issue Mar 13, 2024 · 0 comments
Assignees

Comments

@zhangyangyu
Copy link

zhangyangyu commented Mar 13, 2024

Document Link

https://github.com/go-gorm/gorm.io/blob/master/pages/docs/update.md#update-selected-fields

Your Question

The Generated SQL omits the updated_at field. For example:

db.Model(&user).Select("name").Updates(map[string]interface{}{"name": "hello", "age": 18, "active": false})

should generate

UPDATE `users` SET `name`="hello",`updated_at`="2024-03-13 16:12:50.555" WHERE `id` = 111

instead of

UPDATE users SET name='hello' WHERE id=111;

Expected answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants