mirror of
https://github.com/ent/ent.git
synced 2026-04-30 06:30:55 +03:00
enable distinct in sqlQuery
This commit is contained in:
@@ -178,6 +178,9 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery(ctx context.Context) *sql.Select
|
||||
selector = {{ $receiver }}.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if {{ $receiver }}.unique != nil && *{{ $receiver }}.unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
{{- /* Allow mutating the sql.Selector by ent extensions or user templates.*/}}
|
||||
{{- with $tmpls := matchTemplate "dialect/sql/query/selector/*" }}
|
||||
{{- range $tmpl := $tmpls }}
|
||||
|
||||
Reference in New Issue
Block a user