com/jinzhu/gorm"和 "github.com/go-sql-driver/mysql"包与我的数据库交互并试图获取表的描述但没有找到函数。请帮助
最佳答案
使用gorm,您可以执行自定义查询并在struct中获取她的返回值,以下是如何显示表描述的示例:
type Result struct {
Field string
Type string
Null string
Key string
Default string
Extra string
}
db.Raw("DESCRIBE TABLE_NAME").Scan(&result)
按 gorm 查看更多: http://jinzhu.me/gorm/advanced.html#sql-builder
关于go - 如何在GoLang中获取MySQL表的描述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41262973/