Skip to content

Instantly share code, notes, and snippets.

@jeantessier
Created October 21, 2014 05:11
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 jeantessier/03dd22e7db0e9f23cf04 to your computer and use it in GitHub Desktop.
Save jeantessier/03dd22e7db0e9f23cf04 to your computer and use it in GitHub Desktop.
Building a histogram from a Grails criteria search.
Employee.withCriteria {
projections {
groupProperty "gender"
rowCount()
}
}.inject([:]) { histo, row ->
histo[row[0]] = row[1]
histo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment