[Postgres] Add support for DISTINCT ON clause.

This commit is contained in:
go-jet 2022-01-06 18:11:26 +01:00
parent 5cbf4aac86
commit 6fe9c26d30
3 changed files with 69 additions and 4 deletions

View file

@ -44,7 +44,7 @@ type SelectStatement interface {
jet.HasProjections
Expression
DISTINCT() SelectStatement
DISTINCT(on ...jet.ColumnExpression) SelectStatement
FROM(tables ...ReadableTable) SelectStatement
WHERE(expression BoolExpression) SelectStatement
GROUP_BY(groupByClauses ...GroupByClause) SelectStatement
@ -104,8 +104,9 @@ type selectStatementImpl struct {
For jet.ClauseFor
}
func (s *selectStatementImpl) DISTINCT() SelectStatement {
func (s *selectStatementImpl) DISTINCT(on ...jet.ColumnExpression) SelectStatement {
s.Select.Distinct = true
s.Select.DistinctOnColumns = on
return s
}