I have been struggling with passing an array/slice from Golang to a sqlc (postgres) database query WHERE clause that has an IN operator. There is very little documentation around this function and it leaves some info out (such as how you would mark what kind of array it is with something like ::text[]). Whether I tried:
table.jsonb_col->>'some_id' IN (sqlc.slice('list_of_ids')::text[]) or
table.jsonb_col->>'some_id' IN (@list_of_ids::text[])
It didn't matter and I would always get the error
ERROR: operator does not exist: text = text[] (SQLSTATE 42883)
What I found out later is that it seems go is passing an array to the sql statement, but the sql is expecting a set of rows (or values, I'm not sure on the terminology) or something equivalent to that.
From what little I could find about the subject this is the way to do it, but it just didn't work.