4

I need to find out how to implement MySql's Group_Concat under Esqueleto in Haskell. The esqueleto function should look like the following but this version is suitable for Sqlite. So I need a working solution for Mysql:

sqliteGroupConcat ::
     PersistField a
  => SqlExpr (Value a)
  -> SqlExpr (Value a)
  -> SqlExpr (Value Text)
 -- sqliteGroupConcat (t ^. BookmarkTagTag) (val " ") 
sqliteGroupConcat expr sep = unsafeSqlFunction "GROUP_CONCAT" [expr, sep]

I cannot use this group_concat function for mysql as the inputs in mysql's version aren't comma separated. The group_concat function for mysql should be able to perform the following sql function:

GROUP_CONCAT(country SEPARATOR ';')
angie
  • 59
  • 5
  • As far as I know it isn't directly supported by Esqueleto, but the following GH issue shows how you can make it work (probably): https://github.com/bitemyapp/esqueleto/issues/182 – Carlos Agarie Jun 03 '22 at 00:50

0 Answers0