Created
January 19, 2020 13:27
-
-
Save yutakahashi114/dedf7f98153f9bc3525dcc90d2ae9983 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 userForNoLock struct { | |
ID uint64 `xorm:"autoincr"` | |
FirstName string | |
LastName string | |
FirstNameKana string | |
LastNameKana string | |
CreatedAt time.Time `xorm:"created"` | |
UpdatedAt time.Time `xorm:"updated"` | |
DeletedAt time.Time `xorm:"deleted"` | |
} | |
func (userForNoLock) TableName() string { | |
return "users" | |
} | |
{ | |
ufnl := userForNoLock{ | |
FirstName: "太郎更新", | |
FirstNameKana: "タロウコウシン", | |
} | |
affected, err := engine. | |
Where("id = ?", id). | |
Update(&ufnl) | |
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