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

Function columnConstraintSQL

pkg/sql/ast/sql.go:1473–1492  ·  view source on GitHub ↗
(c *ColumnConstraint)

Source from the content-addressed store, hash-verified

1471}
1472
1473func columnConstraintSQL(c *ColumnConstraint) string {
1474 switch c.Type {
1475 case "NOT NULL", "UNIQUE", "PRIMARY KEY":
1476 return c.Type
1477 case "DEFAULT":
1478 return "DEFAULT " + exprSQL(c.Default)
1479 case "REFERENCES":
1480 if c.References != nil {
1481 return referenceSQL(c.References)
1482 }
1483 return "REFERENCES"
1484 case "CHECK":
1485 return "CHECK (" + exprSQL(c.Check) + ")"
1486 default:
1487 if c.AutoIncrement {
1488 return "AUTO_INCREMENT"
1489 }
1490 return c.Type
1491 }
1492}
1493
1494func tableConstraintSQL(tc *TableConstraint) string {
1495 sb := getBuilder()

Callers 1

columnDefSQLFunction · 0.70

Calls 2

exprSQLFunction · 0.70
referenceSQLFunction · 0.70

Tested by

no test coverage detected