Skip to content

Commit

Permalink
Add SELECT_DISTINCT query type
Browse files Browse the repository at this point in the history
  • Loading branch information
emdash committed Dec 4, 2023
1 parent 421547f commit 1139c97
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Sqlite3/Cmd.idr
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ record Query (t : Type) where
[noHints]
constructor Q
{auto fromRow : FromRow t}
distinct : Bool
schema : Schema
from : From schema
columns : LAll (NamedExpr schema) (FromRowTypes t)
Expand Down Expand Up @@ -376,7 +377,16 @@ SELECT :
-> LAll (NamedExpr s) (FromRowTypes t)
-> From s
-> Query t
SELECT xs from = Q s from xs TRUE TRUE [] [] Nothing 0
SELECT xs from = Q False s from xs TRUE TRUE [] [] Nothing 0

public export %inline
SELECT_DISTINCT :
{s : _}
-> {auto fromRow : FromRow t}
-> LAll (NamedExpr s) (FromRowTypes t)
-> From s
-> Query t
SELECT_DISTINCT xs from = Q True s from xs TRUE TRUE [] [] Nothing 0

public export %inline
GROUP_BY : (q : Query t) -> List (GroupingTerm $ ExprSchema q.columns) -> Query t
Expand Down

0 comments on commit 1139c97

Please sign in to comment.