Closed andystroz closed 5 years ago
For the GORM demo the struct definition should be
type Reminder struct { Id int64 `json:"id"` Message string `sql:"size:1024" json:"message"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt *time.Time `json:"-"` }
If the DeletedAt param is not defined as *time.Time the the PutReminder function will save not NULL to the DeletedAt column in the database. Consequently calling i.DB.First(&reminder, id).Error returns a record not found error.
*time.Time
PutReminder
i.DB.First(&reminder, id).Error
For the GORM demo the struct definition should be
If the DeletedAt param is not defined as
*time.Time
the thePutReminder
function will save not NULL to the DeletedAt column in the database. Consequently callingi.DB.First(&reminder, id).Error
returns a record not found error.