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

Function referenceSQL

pkg/sql/ast/sql.go:1528–1547  ·  view source on GitHub ↗
(r *ReferenceDefinition)

Source from the content-addressed store, hash-verified

1526}
1527
1528func referenceSQL(r *ReferenceDefinition) string {
1529 sb := getBuilder()
1530 defer putBuilder(sb)
1531 sb.WriteString("REFERENCES ")
1532 sb.WriteString(r.Table)
1533 if len(r.Columns) > 0 {
1534 sb.WriteString(" (")
1535 sb.WriteString(strings.Join(r.Columns, ", "))
1536 sb.WriteString(")")
1537 }
1538 if r.OnDelete != "" {
1539 sb.WriteString(" ON DELETE ")
1540 sb.WriteString(r.OnDelete)
1541 }
1542 if r.OnUpdate != "" {
1543 sb.WriteString(" ON UPDATE ")
1544 sb.WriteString(r.OnUpdate)
1545 }
1546 return sb.String()
1547}
1548
1549func alterActionSQL(a *AlterTableAction) string {
1550 switch a.Type {

Callers 2

columnConstraintSQLFunction · 0.70
tableConstraintSQLFunction · 0.70

Calls 3

getBuilderFunction · 0.85
putBuilderFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected