windowSpecSQL renders a window specification.
(w *ast.WindowSpec)
| 1346 | |
| 1347 | // windowSpecSQL renders a window specification. |
| 1348 | func windowSpecSQL(w *ast.WindowSpec) string { |
| 1349 | var parts []string |
| 1350 | if w.Name != "" { |
| 1351 | parts = append(parts, w.Name) |
| 1352 | } |
| 1353 | if len(w.PartitionBy) > 0 { |
| 1354 | parts = append(parts, "PARTITION BY "+exprListSQL(w.PartitionBy)) |
| 1355 | } |
| 1356 | if len(w.OrderBy) > 0 { |
| 1357 | parts = append(parts, "ORDER BY "+orderBySQL(w.OrderBy)) |
| 1358 | } |
| 1359 | if w.FrameClause != nil { |
| 1360 | parts = append(parts, windowFrameSQL(w.FrameClause)) |
| 1361 | } |
| 1362 | return strings.Join(parts, " ") |
| 1363 | } |
| 1364 | |
| 1365 | // windowFrameSQL renders a window frame clause. |
| 1366 | func windowFrameSQL(f *ast.WindowFrame) string { |
no test coverage detected