MCPcopy
hub / github.com/go-gorm/gorm / Having

Method Having

chainable_api.go:297–303  ·  view source on GitHub ↗

Having specify HAVING conditions for GROUP BY // Select the sum age of users with name jinzhu db.Model(&User{}).Select("name, sum(age) as total").Group("name").Having("name = ?", "jinzhu").Find(&result)

(query interface{}, args ...interface{})

Source from the content-addressed store, hash-verified

295// // Select the sum age of users with name jinzhu
296// db.Model(&User{}).Select("name, sum(age) as total").Group("name").Having("name = ?", "jinzhu").Find(&result)
297func (db *DB) Having(query interface{}, args ...interface{}) (tx *DB) {
298 tx = db.getInstance()
299 tx.Statement.AddClause(clause.GroupBy{
300 Having: tx.Statement.BuildCondition(query, args...),
301 })
302 return
303}
304
305// Order specify order when retrieving records from database
306//

Callers

nothing calls this directly

Calls 3

getInstanceMethod · 0.95
AddClauseMethod · 0.80
BuildConditionMethod · 0.80

Tested by

no test coverage detected