MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / windowSpecSQL

Function windowSpecSQL

pkg/formatter/render.go:1348–1363  ·  view source on GitHub ↗

windowSpecSQL renders a window specification.

(w *ast.WindowSpec)

Source from the content-addressed store, hash-verified

1346
1347// windowSpecSQL renders a window specification.
1348func 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.
1366func windowFrameSQL(f *ast.WindowFrame) string {

Callers 1

renderSelectFunction · 0.70

Calls 3

exprListSQLFunction · 0.70
orderBySQLFunction · 0.70
windowFrameSQLFunction · 0.70

Tested by

no test coverage detected