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

Function renderDrop

pkg/formatter/render.go:886–913  ·  view source on GitHub ↗
(d *ast.DropStatement, opts ast.FormatOptions)

Source from the content-addressed store, hash-verified

884}
885
886func renderDrop(d *ast.DropStatement, opts ast.FormatOptions) string {
887 if d == nil {
888 return ""
889 }
890 f := newNodeFormatter(opts)
891 sb := f.sb
892
893 sb.WriteString(f.kw("DROP"))
894 sb.WriteString(" ")
895 sb.WriteString(f.kw(d.ObjectType))
896 sb.WriteString(" ")
897 if d.IfExists {
898 sb.WriteString(f.kw("IF EXISTS"))
899 sb.WriteString(" ")
900 }
901 sb.WriteString(strings.Join(d.Names, ", "))
902
903 if d.CascadeType != "" {
904 sb.WriteString(" ")
905 sb.WriteString(f.kw(d.CascadeType))
906 }
907
908 if opts.AddSemicolon {
909 sb.WriteString(";")
910 }
911
912 return f.result()
913}
914
915func renderTruncate(t *ast.TruncateStatement, opts ast.FormatOptions) string {
916 if t == nil {

Callers 1

FormatStatementFunction · 0.85

Calls 3

newNodeFormatterFunction · 0.85
kwMethod · 0.80
resultMethod · 0.80

Tested by

no test coverage detected