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

Method SQL

pkg/sql/ast/sql.go:934–950  ·  view source on GitHub ↗

SQL returns the SQL representation of this WITH clause including any RECURSIVE modifier and all CTE definitions.

()

Source from the content-addressed store, hash-verified

932// SQL returns the SQL representation of this WITH clause including any RECURSIVE
933// modifier and all CTE definitions.
934func (w *WithClause) SQL() string {
935 if w == nil {
936 return ""
937 }
938 sb := getBuilder()
939 defer putBuilder(sb)
940 sb.WriteString("WITH ")
941 if w.Recursive {
942 sb.WriteString("RECURSIVE ")
943 }
944 ctes := make([]string, len(w.CTEs))
945 for i, cte := range w.CTEs {
946 ctes[i] = cteSQL(cte)
947 }
948 sb.WriteString(strings.Join(ctes, ", "))
949 return sb.String()
950}
951
952// SQL returns the SQL representation of this set operation as
953// "left UNION|EXCEPT|INTERSECT [ALL] right".

Callers 3

TestWithClause_SQLFunction · 0.95
TestCTEWithMaterializedFunction · 0.95
TestNilSQLFunction · 0.95

Calls 4

getBuilderFunction · 0.85
putBuilderFunction · 0.85
cteSQLFunction · 0.85
StringMethod · 0.45

Tested by 3

TestWithClause_SQLFunction · 0.76
TestCTEWithMaterializedFunction · 0.76
TestNilSQLFunction · 0.76