上一页 1 2 3 4 5 6 7 8 ··· 83 下一页
摘要: type User struct { Name string `gorm:"size:255"` //string默认长度255,size重设长度 Age int `gorm:"column:my_age"` //设置列名为my_age Num int `gorm:"AUTO_INCREMENT"` 阅读全文
posted @ 2021-06-07 20:41 winyh 阅读(109) 评论(0) 推荐(0) 编辑
摘要: JSON Tag 的简单应用 - 自定义字段名,去掉空值字段 默认情况下,结构体序列化后的字段名和结构体的字段名保持一致,如在结构体中定义了对外公开的字段,字段名首字母都是大写的,JSON 序列化后得到的也是首字母大写的字段名,并不符合日常开发习惯。 其实 go 提供了在结构体中使用 JSON Ta 阅读全文
posted @ 2021-06-07 18:42 winyh 阅读(182) 评论(0) 推荐(0) 编辑
摘要: https://blog.jetbrains.com/2020/06/18/goland-template/?lang=zh-hans 阅读全文
posted @ 2021-05-30 14:54 winyh 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Update 可以更新单个值,即使非零值 阅读全文
posted @ 2021-05-29 19:10 winyh 阅读(600) 评论(0) 推荐(0) 编辑
摘要: Error 1292: Incorrect datetime value: '0000-00-00' for column 'end_at' at row StartAt time.Time `json:"start_at" gorm:"comment:广告开始时间"`EndAt time.Time 阅读全文
posted @ 2021-05-29 10:18 winyh 阅读(513) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 83 下一页