orderBySQL renders ORDER BY expressions.
(orders []ast.OrderByExpression)
| 1226 | |
| 1227 | // orderBySQL renders ORDER BY expressions. |
| 1228 | func orderBySQL(orders []ast.OrderByExpression) string { |
| 1229 | parts := make([]string, len(orders)) |
| 1230 | for i, o := range orders { |
| 1231 | s := exprSQL(o.Expression) |
| 1232 | if !o.Ascending { |
| 1233 | s += " DESC" |
| 1234 | } |
| 1235 | if o.NullsFirst != nil { |
| 1236 | if *o.NullsFirst { |
| 1237 | s += " NULLS FIRST" |
| 1238 | } else { |
| 1239 | s += " NULLS LAST" |
| 1240 | } |
| 1241 | } |
| 1242 | parts[i] = s |
| 1243 | } |
| 1244 | return strings.Join(parts, ", ") |
| 1245 | } |
| 1246 | |
| 1247 | // tableRefSQL renders a TableReference. The formatter is threaded through |
| 1248 | // so PIVOT/UNPIVOT/FOR/IN/AS/LATERAL keywords honor the caller's case policy. |
no test coverage detected