-
-
Couldn't load subscription status.
- Fork 4.1k
Closed
Labels
type:with reproduction stepswith reproduction stepswith reproduction steps
Description
GORM Playground Link
Description
When I use the where statement, the printed sql in console is wrong that makes me think there is something wrong with the sql statement.
It should print number rather than string when the underlying type is int.
type UserStatus int
const (
Normal UserStatus = 1
Forbid UserStatus = 2
)
// print: SELECT * FROM `users` WHERE status = '1' AND `users`.`deleted_at` IS NULL
DB.Where("status = ?", Normal).Find(&users)
// print: SELECT * FROM `users` WHERE status = 1 AND `users`.`deleted_at` IS NULL
DB.Where("status = ?", 1).Find(&users)Metadata
Metadata
Assignees
Labels
type:with reproduction stepswith reproduction stepswith reproduction steps