File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
src/Droplet/Language/Internal Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,12 @@ class ToArrayAgg (f ∷ Type) (fields ∷ Row Type) (t ∷ Type) | f → fields
68
68
69
69
instance (Cons name t e fields , UnwrapDefinition t u ) ⇒ ToArrayAgg (Proxy name ) fields u
70
70
71
- instance (Cons name t e fields , UnwrapDefinition t u ) ⇒ ToArrayAgg (Path alias name ) fields u
71
+ instance
72
+ ( AppendPath alias name fullPath
73
+ , Cons fullPath t e fields
74
+ , UnwrapDefinition t u
75
+ ) ⇒
76
+ ToArrayAgg (Path alias name ) fields u
72
77
73
78
-- | Function arguments must match input type
74
79
class MatchArgumentList (input ∷ Type ) (args ∷ Type ) (fields ∷ Row Type )
Original file line number Diff line number Diff line change @@ -737,8 +737,10 @@ instance
737
737
ToArrayAgg (OrderBy (Proxy name ) (Proxy otherName )) fields w
738
738
739
739
instance
740
- ( Cons name t e fields
741
- , Cons otherName v r fields
740
+ ( AppendPath alias name fullPath
741
+ , Cons fullPath t e fields
742
+ , AppendPath otherAlias otherName otherFullPath
743
+ , Cons otherFullPath v r fields
742
744
, UnwrapDefinition v w
743
745
) ⇒
744
746
ToArrayAgg (OrderBy (Path alias name ) (Path otherAlias otherName )) fields w
Original file line number Diff line number Diff line change 1
1
module Test.Function where
2
2
3
- import Prelude
3
+ import Prelude hiding ( join )
4
4
5
5
import Data.BigInt as DB
6
6
import Data.Maybe (Maybe (..))
@@ -89,6 +89,10 @@ tests = TS.describe "functions" do
89
89
let q = select (array_agg (u ... id) # as u) # from (users # as u)
90
90
TM.notParameterized """SELECT array_agg("u"."id") AS "u" FROM "users" AS "u"""" $ DLIQ.buildQuery q
91
91
TM.result q [ { u: Just [1, 2] } ]
92
+ TS.it "joined source" do
93
+ let q = select (array_agg (u ... id) # as u) # from (join (users # as u) (messages # as t) # on (u ... id .=. t ... id))
94
+ TM.notParameterized """SELECT array_agg("u"."id") AS "u" FROM "users" AS "u" INNER JOIN "messages" AS "t" ON "u"."id" = "t"."id"""" $ DLIQ.buildQuery q
95
+ TM.result q [ { u: Just [1, 2] } ]
92
96
TS.describe "order by" do
93
97
TS.it "field" do
94
98
let q = select (array_agg (id # orderBy id) # as u) # from users
You can’t perform that action at this time.
0 commit comments