摘要: 结构体 type Mould struct { MouldId string `grom:"column:mouldID"` MouldInteriorID string `grom:"column:mouldInteriorID"` MouldName string `grom:"column:m 阅读全文
posted @ 2020-07-18 12:01 HaimaBlog 阅读(3209) 评论(0) 推荐(0) 编辑
摘要: 增 db.Create(user) db.Save(user) 参数只能用**结构体指针****,因为要根据指针写入该条插入的数据, 所以user可以作为该条数据使用。 新增只能用结构体 save方法在没有主键的时候是新增,有主键的时候是更新,save可以解决空字段问题。 可以使用 db.NewRe 阅读全文
posted @ 2020-07-18 11:58 HaimaBlog 阅读(1695) 评论(0) 推荐(0) 编辑
摘要: 保存时间 思路: 前端传时间戳, 后台表里的时间类型为timestamp, model结构体tag设置为 *time.Time json:"activationTime" gorm:"type:timestamp;default:'null'" 默认存null 存前端传传来的时间戳时,按下面的代码处 阅读全文
posted @ 2020-07-18 10:56 HaimaBlog 阅读(1643) 评论(0) 推荐(0) 编辑