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

Method SQL

pkg/sql/ast/sql.go:1020–1046  ·  view source on GitHub ↗

SQL returns the full SQL string for this CREATE MATERIALIZED VIEW statement.

()

Source from the content-addressed store, hash-verified

1018
1019// SQL returns the full SQL string for this CREATE MATERIALIZED VIEW statement.
1020func (c *CreateMaterializedViewStatement) SQL() string {
1021 if c == nil {
1022 return ""
1023 }
1024 sb := getBuilder()
1025 defer putBuilder(sb)
1026 sb.WriteString("CREATE MATERIALIZED VIEW ")
1027 if c.IfNotExists {
1028 sb.WriteString("IF NOT EXISTS ")
1029 }
1030 sb.WriteString(c.Name)
1031 if len(c.Columns) > 0 {
1032 sb.WriteString(" (")
1033 sb.WriteString(strings.Join(c.Columns, ", "))
1034 sb.WriteString(")")
1035 }
1036 sb.WriteString(" AS ")
1037 sb.WriteString(stmtSQL(c.Query))
1038 if c.WithData != nil {
1039 if *c.WithData {
1040 sb.WriteString(" WITH DATA")
1041 } else {
1042 sb.WriteString(" WITH NO DATA")
1043 }
1044 }
1045 return sb.String()
1046}
1047
1048// SQL returns the SQL string for this REFRESH MATERIALIZED VIEW statement.
1049func (r *RefreshMaterializedViewStatement) SQL() string {

Callers 2

TestNilSQLFunction · 0.95

Calls 4

getBuilderFunction · 0.85
putBuilderFunction · 0.85
stmtSQLFunction · 0.70
StringMethod · 0.45

Tested by 2

TestNilSQLFunction · 0.76