Closed quetz closed 7 years ago
dat.EnableInterpolate = true
would be the way to turn it on in an init
function
Use gopkg.in/mgutz/dat.v2
I'm using code at commit 494217c and MustInterpolate
is mentioned only in README.md
but nowhere in code. Must be wrong branch or something...
The README is inaccurate, my apologies. I removed that a while back favoring error values instead of panicking. The next version removes almost all panics.
If you want to use Interpolate
directly.
sql, args, err := dat.Interpolate("select * from users where id IN $1", []int64{1, 2, 3})
if err != nil {
return nil, err
}
var users []*User
_, err = DB.SQL(sql, args).QueryStructs(&users)
Thanks, that works!
I'm using v2 version of dat and
MustInterpolate
is mentioned only in documentation, I can't find it anywhere in the code. And without it queries end up with$brj$
spliced in.What's correct way of doing IN queries and what project branch is most actively developed at the moment?