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
Version: a6b9300
Where statements aren't being transformed into "WHERE IN (?, ...)" statements if the value of a squirrel.Eq key is of type []uint8.
squirrel.Eq
[]uint8
package main import ( "fmt" "github.com/Masterminds/squirrel" ) func main() { query, args, err := squirrel.Select("*").Where(squirrel.Eq{"test": []uint32{1, 2, 3}}).ToSql() if err != nil { panic(err) } fmt.Println(query) // SELECT * WHERE test IN (?,?,?) fmt.Println(args) // [1 2 3] }
package main import ( "fmt" "github.com/Masterminds/squirrel" ) func main() { query, args, err := squirrel.Select("*").Where(squirrel.Eq{"test": []uint8{1, 2, 3}}).ToSql() if err != nil { panic(err) } fmt.Println(query) // SELECT * WHERE test = ? fmt.Println(args) // [[1 2 3]] }
The text was updated successfully, but these errors were encountered:
Squirrel doesn't touch values when driver.IsValue(value) is true. It looks like byte is really just an alias for uint8, and driver.IsValue([]byte{}) is true.
driver.IsValue(value)
byte
uint8
driver.IsValue([]byte{})
I don't think this can be fixed backward-compatibly.
Thank you! Maybe you should warn about this pitfall in the README and the docs.
0fcd409
Good idea. Added an FAQ section with this.
Version: a6b9300
Where statements aren't being transformed into "WHERE IN (?, ...)" statements if the value of a
squirrel.Eq
key is of type[]uint8
.Correct:
Bug:
The text was updated successfully, but these errors were encountered: