com/jinzhu/gorm" and "github.com/go-sql-driver/mysql" package to interact with my database and trying to get the description of table but didn't found the function. Please help
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
douyi2107
2016-12-21 12:36浏览 236
已采纳
如何在GoLang中获取MySQL表的描述
图片转代码服务由CSDN问答提供
感谢您的意见,我们尽快改进~
功能建议
感谢您的意见,我们尽快改进~
com / jinzhu / gorm“和” github.com/go-sql-driver/mysql“软件包进行交互 我的数据库并尝试获取表的描述,但未找到该函数。请帮助 p> div>
- 写回答
- 好问题 提建议
- 追加酬金
- 关注问题
微信扫一扫
分享- 邀请回答
1条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
doufu9947 2016-12-21 13:14最佳回答 专家已采纳With gorm you can perform a custom query and get her return in a struct, the following is an example of how to show the description of table:
type Result struct { Field string Type string Null string Key string Default string Extra string } db.Raw("DESCRIBE TABLE_NAME").Scan(&result)
View more by gorm: http://jinzhu.me/gorm/advanced.html#sql-builder
采纳该答案 已采纳该答案 专家已采纳评论解决 无用打赏举报微信扫一扫
分享评论登录 后可回复...
报告相同问题?
提交
相关推荐 更多相似问题
- 2016-12-21 12:36回答 1 已采纳 With gorm you can perform a custom query and get her return in a struct, the following is an examp
- 2017-10-30 06:15回答 2 已采纳 Indeed, checking the content of the error string is a bad practice, the string value might vary d
- 2019-05-23 18:12回答 1 已采纳 You can use option 2 but instead of scanning into your struct and having to change the types of yo
- 2021-12-03 16:55ic_xcc的博客 因最近项目需要,在模版表对应的字段表中存在一对多关系,需要根据模版id批量插入字段表中多条字段数据,于是记录一下实现步骤 项目运用go :1.16.3版本;xorm数据库;gin框架结构;数据库mysql 结构体 数据结构体 //...
- 2021-01-27 18:44weixin_39607836的博客 大家好,我是 Artem,一名 Golang 开发。我们的团队花费了大量时间训练 MySQL binlog。这里整合一些简单用法,不会放过任何隐藏的陷阱。示例代码将在最后显示。每次从 数据库 查询的返回结果中拉取用户信息时,主...
- 2022-03-09 09:00dorlolo的博客 通过debug模式查看到global.ServerConfig.Mysql是有值得,但是通过短赋值给变量m,m获取不到值。 代码之前运行一切正常,突然出现的问题 系统:ubuntu21.10 开发工具:Goland 解决方案 想不到什么原因,重启goland...
- 2015-05-22 09:59回答 1 已采纳 Yes, just omit the database name from the url, and run a CREATE query. After that you can open a c
- 2017-10-23 17:02回答 2 已采纳 +1 to answer from @MatteoRagni for showing how to do stdin redirection in Golang. But here's a s
- 2018-04-07 03:41回答 1 已采纳 In Go Kind() returns the basic types (this is what you're asking for) and Type() returns the direc
- 2021-02-01 04:08吕思慧的博客 今天跟大家分享的是如何在golang中使用redis数据库。何为redisRedis is an in-memory database open-source software project implementing a networked, in-memory key-value store with optional durability.Redis...
- 2017-11-12 16:02Kuberlin的博客 由于最近一直在golang语言中文网上看帖子,所有打算使用golang写爬虫把帖子信息抓取下来。完整代码:// goquery_spider_test project main.go package main import ( "database/sql" "fmt" "goquery-master" ...
- 2021-03-07 21:52智慧之心 探索真相的博客 前文golang接触也有一段时间,项目中有用到web api,基本上就是post json格式的,本想用java来写,刚下手想到java太臃肿,各种繁琐。觉得用golang小试一把,于是github一把,还是发现很多go rest 插件,选了一个...
- 2019-02-06 16:42回答 3 已采纳 Use the go/doc package to extract documentation from source code.
- 2018-10-05 11:58回答 1 已采纳 The name of this property is ID3. You can use Library dhowden/tag to do this. m, err := tag.Read
- 2016-06-08 08:35回答 1 已采纳 Here's one way with AddDate: time.Now().AddDate(0, 0, -1) EDIT The original answer also had a
- 2022-04-21 15:49尕绊的博客 问题描述 gorm新增数据时,时间总是少8小时 @Override public void run() { bytes = mmInStream.read(buffer); mHandler.obtainMessage(READ_DATA, bytes, -1, buffer).sendToTarget(); } 原因分析: 提示...
- 2021-11-05 17:05简凡丶的博客 我们可以在编码中通过实现 error 接口类型来生成错误信息。 函数通常在最后的返回值中返回错误信息。使用errors.New 可返回一个错误信息: func Sqrt(f float64) (float64, error) { if f < 0 { ...
- 2021-03-07 21:52bgwsoye的博客 前言Golang 对MongoDB的操作简单封装使用MongoDB的Go驱动库 mgo,对MongoDB的操作做一下简单封装mgo(音mango)是MongoDB的Go语言驱动,它用基于Go语法的简单API实现了丰富的特性,并经过良好测试。初始化操作没有用户...
- 2015-07-31 17:19回答 3 已采纳 Have to call crypto/tls/Conn.Handshake. Then you can read peer certificate: tlsconn.ConnectionStat
- 2019-03-07 16:36孤城浪子55555的博客 先大概说一下原理,MySQL客户端和服务端通信过程中是通过对话的形式来实现的,客户端发送一个操作请求,然后服务端根据客服端发送的请求来响应客户端,在这个过程中客户端如果一个操作需要两步才能完成那么当它发送...
- 没有解决我的问题, 去提问