Hey, if I'm using db.Select() with destination being []*someStruct, then everything is okay, but if I use db.Get() with destination being *someStruct then I'm getting similar error:
scannable dest type ptr with >1 columns (6) in result
And I have to pass a _normal_ struct as a destination, not its pointer. I'm just wondering whether this behaviour is intended?
I'm having the same problem.
Thanks for this awesome library
@Albert221 Can you provide more details? Like what your someStruct is, how to you call db.Get()?
db.Get() will call scanAny() in which
if scannable && len(columns) > 1 {
return fmt.Errorf("scannable dest type %s with >1 columns (%d) in result", base.Kind(), len(columns))
}
Perhaps you can debug with scanAny() in sqlx.go
@Albert221 and @feelfreelinux your query returns more than one row. db.Get is intended to handle only one row being returned. Either use db.Select or LIMIT 1 your query.
@glaslos Hello, I have the same issue. And the problem is that my query returns only one row.
I tried to add LIMIT 1 and it's not working too.
I'm using sqlx to query Clickhouse DB.
@glaslos debugger showed me fields from only one row, so I don't think that returning more than one row is the cause of it here
@Albert221 Because the *someStruct is not a struct pointer
Most helpful comment
@Albert221 Because the
*someStructis not a struct pointer