dialect/sql/sqljson: support for order by value and length (#3278)

This commit is contained in:
Ariel Mashraki
2023-01-26 12:20:31 +02:00
committed by GitHub
parent 604c4942a4
commit 433609444c
6 changed files with 258 additions and 81 deletions

View File

@@ -2733,6 +2733,14 @@ func Desc(column string) string {
return b.String()
}
// DescExpr returns a new expression where the DESC suffix is added.
func DescExpr(x Querier) Querier {
return ExprFunc(func(b *Builder) {
b.Join(x)
b.WriteString(" DESC")
})
}
// OrderBy appends the `ORDER BY` clause to the `SELECT` statement.
func (s *Selector) OrderBy(columns ...string) *Selector {
for i := range columns {