侧边栏壁纸
  • 累计撰写 72 篇文章
  • 累计创建 91 个标签
  • 累计收到 10 条评论

目 录CONTENT

文章目录

gorm如何获取数据库中所有的表名【show tables】

Kunkka Wu
2024-01-19 / 0 评论 / 0 点赞 / 3805 阅读 / 0 字
温馨提示:
部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

golang gorm show tables

// 获取表结构
tables := make([]string, 0)
if err = db.Raw("SHOW TABLES").Scan(&tables).Error; err != nil {

}

输出结果:

{
    "data": [
        "code_box",
        "eat_what",
        "feedback",
        "link",
        "sms_send",
        "system_config",
        "timeline",
        "tools",
        "user"
    ],
    "code": 200,
    "msg": ""
}

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区