Skip to content
Advertisement

Tag: slice

Scan row into slice

I want to Scan a sql.Row into a slice like so: but I am getting this error: 2020/02/23 20:05:14 raw query: SELECT * FROM user_table LIMIT 500 2020/02/23 20:05:14 sql: expected 6 destination arguments in Scan, not 0 anyone know how to make this generic without using a slice? Answer You can do it this way: on the internet they

Golang db query using slice IN clause

Can someone explain to me why this does not work? And this does I’m trying to do a simple IN clause with a slice of ints, and every solution suggested doesn’t seem very idiomatic Tried to do this, but the problem appears to be the string substitution. I’m a bit surprised that go doesn’t seem to have a graceful way

Advertisement