#383·squirrel

Where with raw sql string and slice arg

Author: m15h4nyaCreated Oct 22, 2024Updated Nov 4, 2024

Given:

go
query := sq.Select("something FROM somewhere").Where("id NOT IN ?", []int{1, 2, 3})

Expected:

sql
SELECT something FROM somewhere WHERE id NOT IN (1, 2, 3);

Actual:

sql
SELECT something FROM somewhere WHERE id NOT IN '[1 2 3]';

Trying to actually execute query returns error (SQLSTATE 42601) saying there is syntax error near ? (or $1 if using dollar placeholders)

go play: https://go.dev/play/p/79B21fBnUgJ