GORM Playground Link
https://github.com/go-gorm/playground/pull/682
Description
var id uint = 1
DB.Table("users").Where("id = ?", id).Find(&users)
DB.Table("users").Where("id = ?", &id).Find(&users)
When using a value or a pointer, this kind of code behaves the same way
ids := []uint{1, 2, 3}
DB.Table("users").Where("id IN (?)", ids).Find(&users)
DB.Table("users").Where("id IN (?)", &ids).Find(&users)
I would assume that this would also happen with slices.
With a simple slice, SELECT * WHERE id IN (?) gets expanded to SELECT * WHERE id IN (?,?,?).
But with a slice pointer, this does not happen.
This case with a pointer slice is not handled in https://github.com/go-gorm/gorm/blob/master/clause/expression.go#L41
I think the same happens with clause.Where
This case was specially annoying to pinpoint because the query returns this error Failed, got error: sql: converting argument $1 type: unsupported type []uint, a slice of uint. Later I found that this error was in the go sql package. Now makes sense, but at first glance I did not know if the error was in the gorm code or not.
Do you intend to support this case? If so, I think, I can implement it. Just need to know how is the more "gorm" like approach. I would suspect it would be reflection. I think I have seen code that does the slice pointer slice somewhere already.