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

fix: 'type XXXX int' will print wrong sql to terminal #6917

merged 1 commit into from Mar 21, 2024


Copy link

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

ref: #6898

The wrong sql printed to the terminal can be confusing when use type XXX int, so fix it.

User Case Description

type UserStatus int

const (
	Normal UserStatus = 1
	Forbid UserStatus = 2

DB.Where("status = ?", Normal).Find(&users)

It print:

SELECT * FROM `users` WHERE status = '1' AND `users`.`deleted_at` IS NULL

The expected print is:

SELECT * FROM `users` WHERE status = 1 AND `users`.`deleted_at` IS NULL

@jinzhu jinzhu merged commit 956f7ce into go-gorm:master Mar 21, 2024
29 of 35 checks passed
Copy link

jinzhu commented Mar 21, 2024

thank you for your PR

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

Successfully merging this pull request may close these issues.

None yet

2 participants