SQL returns the SQL representation of this TRUNCATE statement, including table names, RESTART/CONTINUE IDENTITY options, and CASCADE/RESTRICT behavior.
()
| 910 | // SQL returns the SQL representation of this TRUNCATE statement, including |
| 911 | // table names, RESTART/CONTINUE IDENTITY options, and CASCADE/RESTRICT behavior. |
| 912 | func (t *TruncateStatement) SQL() string { |
| 913 | if t == nil { |
| 914 | return "" |
| 915 | } |
| 916 | sb := getBuilder() |
| 917 | defer putBuilder(sb) |
| 918 | sb.WriteString("TRUNCATE TABLE ") |
| 919 | sb.WriteString(strings.Join(t.Tables, ", ")) |
| 920 | if t.RestartIdentity { |
| 921 | sb.WriteString(" RESTART IDENTITY") |
| 922 | } else if t.ContinueIdentity { |
| 923 | sb.WriteString(" CONTINUE IDENTITY") |
| 924 | } |
| 925 | if t.CascadeType != "" { |
| 926 | sb.WriteString(" ") |
| 927 | sb.WriteString(t.CascadeType) |
| 928 | } |
| 929 | return sb.String() |
| 930 | } |
| 931 | |
| 932 | // SQL returns the SQL representation of this WITH clause including any RECURSIVE |
| 933 | // modifier and all CTE definitions. |