Remove blank array if no args

This commit is contained in:
Hein 2025-12-03 12:25:51 +02:00
parent 32007480c6
commit 06b2404c0c
2 changed files with 11 additions and 3 deletions

View File

@ -147,8 +147,11 @@ func (b *BunSelectQuery) Column(columns ...string) common.SelectQuery {
} }
func (b *BunSelectQuery) ColumnExpr(query string, args ...interface{}) common.SelectQuery { func (b *BunSelectQuery) ColumnExpr(query string, args ...interface{}) common.SelectQuery {
if len(args) > 0 {
b.query = b.query.ColumnExpr(query, args) b.query = b.query.ColumnExpr(query, args)
} else {
b.query = b.query.ColumnExpr(query)
}
return b return b
} }

View File

@ -125,7 +125,12 @@ func (g *GormSelectQuery) Column(columns ...string) common.SelectQuery {
} }
func (g *GormSelectQuery) ColumnExpr(query string, args ...interface{}) common.SelectQuery { func (g *GormSelectQuery) ColumnExpr(query string, args ...interface{}) common.SelectQuery {
if len(args) > 0 {
g.db = g.db.Select(query, args...) g.db = g.db.Select(query, args...)
} else {
g.db = g.db.Select(query)
}
return g return g
} }