golang执行mysql读取数据

import (
  "sql"
  "fmt"
)

db, _ := sql.Open(...)
commondSql := 'select * from table where 1 limit1'
var id
var name
var time
rows, _ := db.Query(commondSql)
rows.Next()
rows.Scan(&id, &name, &time)
fmt.Println(id, name, time)

  

原文地址:https://www.cnblogs.com/supermarx/p/14539598.html