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{})
| 92 | // // Select distinct name/age pairs from users |
| 93 | // db.Distinct("name", "age").Find(&results) |
| 94 | func (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 | // |
nothing calls this directly
no test coverage detected