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

Method formatDrop

cmd/gosqlx/cmd/sql_formatter.go:1134–1157  ·  view source on GitHub ↗

formatDrop formats DROP statements

(stmt *ast.DropStatement)

Source from the content-addressed store, hash-verified

1132
1133// formatDrop formats DROP statements
1134func (f *SQLFormatter) formatDrop(stmt *ast.DropStatement) error {
1135 f.writeKeyword("DROP")
1136 f.builder.WriteString(" ")
1137 f.writeKeyword(stmt.ObjectType)
1138
1139 if stmt.IfExists {
1140 f.builder.WriteString(" ")
1141 f.writeKeyword("IF EXISTS")
1142 }
1143
1144 for i, name := range stmt.Names {
1145 if i > 0 {
1146 f.builder.WriteString(",")
1147 }
1148 f.builder.WriteString(" " + name)
1149 }
1150
1151 if stmt.CascadeType != "" {
1152 f.builder.WriteString(" ")
1153 f.writeKeyword(stmt.CascadeType)
1154 }
1155
1156 return nil
1157}
1158
1159// formatCreateView formats CREATE VIEW statements
1160func (f *SQLFormatter) formatCreateView(stmt *ast.CreateViewStatement) error {

Callers 1

formatStatementMethod · 0.95

Calls 1

writeKeywordMethod · 0.95

Tested by

no test coverage detected