数据库 created_at 报错

来源:5-9 登陆管理功能 - 登陆接口开发

慕圣8591480

2021-10-08

错误信息:
sql: Scan error on column index 4, name “create_at”: unsupported Scan, storing driver.Value type []uint8 into type *time.Time

麻烦老师看一下这里为什么会出错呢?
这是我的 Admin 结构体

type Admin struct {
	Id        int    `json:"id" gorm:"primary_key" description:"自增主键"`
	UserName  string `json:"user_name" gorm:"column:user_name" description:"管理员用户名"`
	Salt      string `json:"salt" gorm:"column:salt" description:"盐"`
	Password  string `json:"password" gorm:"column:password" description:"密码"`
	UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"`
	CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"`
	IsDelete  int    `json:"is_delete" gorm:"column:is_delete" description:"是否删除"`
}
写回答

1回答

牛儿吃草

2021-11-04

需要看一下create_at在数据库表中的格式是否正确?

0
0

(打造简历金牌项目)Vue+Go 开发企业级微服务网关项目

简历中摒弃烂大街的培训机构项目,带你开发企业级微服务网关

1316 学习 · 352 问题

查看课程