DistinctOn returns a derivative query that yields de-duplicated entities with respect to the set of the specified fields. It is only used for projection queries. The field list should be a subset of the projected field list. DistinctOn cannot be used with Distinct.
(fieldNames ...string)
| 212 | // queries. The field list should be a subset of the projected field list. |
| 213 | // DistinctOn cannot be used with Distinct. |
| 214 | func (q *Query) DistinctOn(fieldNames ...string) *Query { |
| 215 | q = q.clone() |
| 216 | q.distinctOn = fieldNames |
| 217 | return q |
| 218 | } |
| 219 | |
| 220 | // KeysOnly returns a derivative query that yields only keys, not keys and |
| 221 | // entities. It cannot be used with projection queries. |