Created
January 19, 2020 13:14
-
-
Save yutakahashi114/388cbc9bb7481d1e3a090088cad1769f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type friendForPhysicalDelete struct { | |
DeletedAt time.Time | |
} | |
func (friendForPhysicalDelete) TableName() string { | |
return "friends" | |
} | |
{ | |
f := friendForPhysicalDelete{} | |
affected, err = engine. | |
Where("user_id = ? OR friend_id = ?", id, id). | |
Delete(&f) | |
if err != nil { | |
log.Println(err) | |
return | |
} | |
if affected == 0 { | |
log.Println("Not Found") | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment