@@ -530,35 +530,30 @@ arraySample_ (QExpr arr) (QExpr n) =
530
530
-- | Postgres array_to_string(array, delimiter) function.
531
531
-- Converts each element to text and joins with the delimiter. NULLs are omitted.
532
532
arrayToString_
533
- :: BeamSqlBackendIsString Postgres text
534
- => QGenExpr ctxt Postgres s (V. Vector a )
533
+ :: QGenExpr ctxt Postgres s (V. Vector a )
535
534
-> QGenExpr ctxt Postgres s text
536
535
-> QGenExpr ctxt Postgres s text
537
536
arrayToString_ (QExpr arr) (QExpr delim) =
538
- QExpr (PgExpressionSyntax . mappend (emit " array_to_string" ) . pgParens . mconcat <$> sequenceA
539
- [ fromPgExpression <$> arr
540
- , pure (emit " , " )
541
- , fromPgExpression <$> delim
542
- ])
537
+ QExpr (PgExpressionSyntax <$> do
538
+ arrExpr <- fromPgExpression <$> arr
539
+ delimExpr <- fromPgExpression <$> delim
540
+ pure $ emit " array_to_string" <> pgParens (arrExpr <> emit " , " <> delimExpr))
543
541
544
542
-- | Postgres array_to_string(array, delimiter, null_string) function.
545
543
-- Converts each element to text and joins with the delimiter. NULLs are
546
544
-- represented by the provided @null_string@.
547
545
arrayToStringWithNull_
548
- :: BeamSqlBackendIsString Postgres text
549
- => QGenExpr ctxt Postgres s (V. Vector a )
546
+ :: QGenExpr ctxt Postgres s (V. Vector a )
550
547
-> QGenExpr ctxt Postgres s text
551
548
-> QGenExpr ctxt Postgres s text
552
549
-> QGenExpr ctxt Postgres s text
553
550
arrayToStringWithNull_ (QExpr arr) (QExpr delim) (QExpr nullStr) =
554
- QExpr (PgExpressionSyntax . mappend (emit " array_to_string" ) . pgParens . mconcat <$> sequenceA
555
- [ fromPgExpression <$> arr
556
- , pure (emit " , " )
557
- , fromPgExpression <$> delim
558
- , pure (emit " , " )
559
- , fromPgExpression <$> nullStr
560
- ])
561
-
551
+ QExpr (PgExpressionSyntax <$> do
552
+ arrExpr <- fromPgExpression <$> arr
553
+ delimExpr <- fromPgExpression <$> delim
554
+ nullStrExpr <- fromPgExpression <$> nullStr
555
+ pure $ emit " array_to_string" <>
556
+ pgParens (mconcat [arrExpr, emit " , " , delimExpr, emit " , " , nullStrExpr]))
562
557
-- ** Array expressions
563
558
564
559
-- | An expression context that determines which types of expressions can be put
0 commit comments