Skip to content

Instantly share code, notes, and snippets.

@yutakahashi114
Created January 19, 2020 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yutakahashi114/4896c8640224e8805ff2f2204dda1cf3 to your computer and use it in GitHub Desktop.
Save yutakahashi114/4896c8640224e8805ff2f2204dda1cf3 to your computer and use it in GitHub Desktop.
type joinedUser struct {
User user `xorm:"extends"`
Friend friend `xorm:"extends"`
}
func (joinedUser) TableName() string {
return "friends"
}
{
jus := []joinedUser{}
err = engine.
Join("INNER", "users", "users.id = friends.friend_id").
Find(&jus)
if err != nil {
log.Println(err)
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment