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

Method Distinct

chainable_api.go:94–101  ·  view source on GitHub ↗

Distinct specify distinct fields that you want querying // Select distinct names of users db.Distinct("name").Find(&results) // Select distinct name/age pairs from users db.Distinct("name", "age").Find(&results)

(args ...interface{})

Source from the content-addressed store, hash-verified

92// // Select distinct name/age pairs from users
93// db.Distinct("name", "age").Find(&results)
94func (db *DB) Distinct(args ...interface{}) (tx *DB) {
95 tx = db.getInstance()
96 tx.Statement.Distinct = true
97 if len(args) > 0 {
98 tx = tx.Select(args[0], args[1:]...)
99 }
100 return
101}
102
103// Select specify fields that you want when querying, creating, updating
104//

Callers

nothing calls this directly

Calls 2

getInstanceMethod · 0.95
SelectMethod · 0.65

Tested by

no test coverage detected