Skip to content

Instantly share code, notes, and snippets.

@yutakahashi114
Created January 19, 2020 13:18
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/b7e3ee4778f8f7d71daa685b99701a05 to your computer and use it in GitHub Desktop.
Save yutakahashi114/b7e3ee4778f8f7d71daa685b99701a05 to your computer and use it in GitHub Desktop.
type countPerUserID struct {
Count uint
UserID uint64
}
func (countPerUserID) TableName() string {
return "friends"
}
{
cpuis := []countPerUserID{}
err = engine.
Select("count(*) as count, user_id").
Where("deleted_at IS NULL").
GroupBy("user_id").
Find(&cpuis)
if err != nil {
log.Println(err)
return
}
}
@uhowep
Copy link

uhowep commented Sep 20, 2023

thanks for show this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment