Skip to content

Commit

Permalink
add postgres StringAgg func
Browse files Browse the repository at this point in the history
  • Loading branch information
zengshun2019 committed Sep 6, 2024
1 parent ebb6364 commit 89b663a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions field/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ func (e expr) GroupConcat() Expr {
return e.setE(clause.Expr{SQL: "GROUP_CONCAT(?)", Vars: []interface{}{e.RawExpr()}})
}

func (e expr) StringAgg() Expr {
return e.setE(clause.Expr{SQL: "STRING_AGG(?, ',')", Vars: []interface{}{e.RawExpr()}})
}

// ======================== comparison between columns ========================
func (e expr) EqCol(col Expr) Expr {
return e.setE(clause.Expr{SQL: "? = ?", Vars: []interface{}{e.RawExpr(), col.RawExpr()}})
Expand Down

0 comments on commit 89b663a

Please sign in to comment.