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

Method SQL

pkg/sql/ast/sql.go:1230–1247  ·  view source on GitHub ↗

SQL returns the SQL representation of this Delete node (dml.go type). For the full-featured DELETE use DeleteStatement.SQL() instead.

()

Source from the content-addressed store, hash-verified

1228// SQL returns the SQL representation of this Delete node (dml.go type).
1229// For the full-featured DELETE use DeleteStatement.SQL() instead.
1230func (d *Delete) SQL() string {
1231 if d == nil {
1232 return ""
1233 }
1234 sb := getBuilder()
1235 defer putBuilder(sb)
1236 sb.WriteString("DELETE FROM ")
1237 sb.WriteString(tableRefSQL(&d.Table))
1238 if d.Where != nil {
1239 sb.WriteString(" WHERE ")
1240 sb.WriteString(exprSQL(d.Where))
1241 }
1242 if len(d.ReturningClause) > 0 {
1243 sb.WriteString(" RETURNING ")
1244 sb.WriteString(exprListSQL(d.ReturningClause))
1245 }
1246 return sb.String()
1247}
1248
1249// ============================================================
1250// Helper functions

Callers 2

TestDelete_SQLFunction · 0.95
TestNilSQLFunction · 0.95

Calls 6

getBuilderFunction · 0.85
putBuilderFunction · 0.85
tableRefSQLFunction · 0.70
exprSQLFunction · 0.70
exprListSQLFunction · 0.70
StringMethod · 0.45

Tested by 2

TestDelete_SQLFunction · 0.76
TestNilSQLFunction · 0.76