![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
gin
zy_whynot
这个作者很懒,什么都没留下…
展开
-
pq: Could not complete operation in a failed transaction
报错使用 Gin + Gorm 开发一个服务时,写的一个增加数据的接口db.Create(&User{…})时报错:pq: Could not complete operation in a failed transaction 翻译过来就是:由于执行事务失败导致添加数据的操作无法执行原因原因是:pq: column “bind_status” does not exist ,保存的 user 对象和数据表的对象结构不一致,导致插入数据失败解决迁移表的结构,user 结构体和数据表原创 2021-10-13 22:00:49 · 491 阅读 · 0 评论 -
gin上传和访问静态文件
需求上传并访问用户头像正式项目的流媒体资源(图片、视频)一般都会放在第三方的云服务器上(七牛云、阿里云等),我自己写的玩呢,就放到本地吧配置静态文件目录router := gin.Default()// 服务静态文件目录//router.Static("/static", "./static")// 服务虚拟静态文件系统router.StaticFS("/static", http.Dir("./static"))// 服务单个静态文件//router.StaticFile("/f原创 2021-09-16 22:53:02 · 1798 阅读 · 0 评论