Skip to content

Instantly share code, notes, and snippets.

@kidinamoto01
Last active January 25, 2018 09:59
Show Gist options
  • Save kidinamoto01/0ae5341f00c99543e35820142a77faa7 to your computer and use it in GitHub Desktop.
Save kidinamoto01/0ae5341f00c99543e35820142a77faa7 to your computer and use it in GitHub Desktop.
//select count(*) from language
var count int
db.Model(&Language{}).Select("count(distinct id)").Count(&count)
fmt.Println("count: ",count)
models.DB.Model(&models.UserInvitation{}).Select("count(distinct(invitee_id))").Where("invitation_code = ?", "abcd").Count(&result)
fmt.Println("count result: ",result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment