makeGroupBy :: IdentInfo -> GroupByClause -> (TLB.Builder, [PersistValue])
makeGroupBy _ (GroupBy []) = (mempty, [])
makeGroupBy info (GroupBy fields) = first ("\nGROUP BY " <>) build
where
build :: (TLB.Builder, [PersistValue])
build = uncommas' $ map match fields
match :: SomeValue -> (TLB.Builder, [PersistValue])
match (SomeValue (ERaw _ f)) = f info
match (SomeValue (ECompositeKey f)) = (mconcat $ f info, mempty)
match (SomeValue (EAliasedValue i _)) = aliasedValueIdentToRawSql i info
match (SomeValue (EValueReference i i')) = valueReferenceToRawSql i i' info
The match (SomeValue (ECompositeKey f)) = (mconcat $ f info, mempty) appears to be the problem. Need something to intersperse commans in there.
Offending code:
The
match (SomeValue (ECompositeKey f)) = (mconcat $ f info, mempty)
appears to be the problem. Need something to intersperse commans in there.