摘要: 结构体验证 用gin框架的数据验证,可以不用解析数据,减少if else,会简洁许多。 处理请求方法 func structValidator(context *gin.Context) { var person Person if err := context.ShouldBind(&person 阅读全文
posted @ 2021-12-13 16:45 专职 阅读(1089) 评论(0) 推荐(0) 编辑
摘要: go 的time.Time,在json序列化是默认 2006-01-02T15:04:05Z07:00 的格式,十分不便, encoding/json包在序列化和反序列化的时候分别调用encode.go 下的Marshaler接口的MarshalJSON方法和decode.go下的Unmarshal 阅读全文
posted @ 2021-12-13 14:09 专职 阅读(1288) 评论(0) 推荐(0) 编辑