golang 中使用mysql报错:“ scannable dest type slice with >1 columns (4) in result”

 

query := fmt.Sprintf("SELECT ....
infos = make([]*struct, 0, 10)
err = s.db.GetContext(ctx, &infos, query)

  返回错误:

scannable dest type slice with >1 columns (4) in result

  解决办法:

替换

 

GetContext

  为:

SelectContext

  


golang 中使用mysql报错:“ scannable dest type slice with >1 columns (4) in result”

上一篇:Mysql语法及部分实例 2020-6-28


下一篇:查询mysql所有表数据、字段信息