Your Question

type Remind struct {
    ID         uint   `gorm:"column:id;primaryKey;autoIncrement" json:"id" form:"id"'`
    PersonID   uint   `gorm:"column:person_id;not null;" json:"person_id" form:"person_id"`
    GuardianID uint   `gorm:"column:guardian_id;" json:"guardian_id" form:"guardian_id"`
    Title      string `gorm:"column:title" json:"title" form:"title"`
    Detail     string `gorm:"column:detail" json:"detail" form:"detail"`
    Cron       string `gorm:"column:cron" json:"cron" form:"cron"`
    Frequency  int    `gorm:"column:frequency" json:"frequency" form:"frequency"` //总共提醒次数
    Status     int    `gorm:"column:status" json:"status" form:"status"`
    //1-off  2-on
    NotifyContact int `gorm:"“column:"notify_contact" json:"notify_contact" form:"notify_contact"` //是否提醒联系人
    //1-不需要 2-需要
    Method     int           `gorm:"column:method" json:"method"`
    Intervals  time.Duration `gorm:"column:intervals" json:"intervals"` //中间间隔时间 纳秒级别  1s = 1*1000*1000*1000
    CreateTime time.Time     `gorm:"autoCreateTime" `
    UpdateTime time.Time     `gorm:"autoUpdateTime"`
    DeleteTime gorm.DeletedAt
}
func (r Remind) TableName() string {
    return "remind"
}

func main(){
    dsn:="XXXXX"
    db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
    if err!=nil{
        fmt.Println(err)
    }
    var r Remind
    db.First(&r)
    //fmt.Println(list[0].InTime)
}

error

 D:/go/src/awesomeProject1/main.go:72 sql: Scan error on column index 10, name "create_time": unsupported Scan, storing driver.Value type []uint8 into type *time.Time

The document you expected this should be explained

Expected answer

3 months ago , this method was ok.

Comment From: xiyichan

I have solved it.

Comment From: congjunhua

兄弟怎么解决的

Comment From: mengdu

@congjunhua dsn := "root:xxxx@tcp(127.0.0.1:3306)/test?charset=utf8mb4&parseTime=True&loc=Local" 要配置下 parseTime=True