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

Method SQL

pkg/sql/ast/sql.go:912–930  ·  view source on GitHub ↗

SQL returns the SQL representation of this TRUNCATE statement, including table names, RESTART/CONTINUE IDENTITY options, and CASCADE/RESTRICT behavior.

()

Source from the content-addressed store, hash-verified

910// SQL returns the SQL representation of this TRUNCATE statement, including
911// table names, RESTART/CONTINUE IDENTITY options, and CASCADE/RESTRICT behavior.
912func (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.

Callers 3

TestNilSQLFunction · 0.95
TestTruncateStatementSQLFunction · 0.95

Calls 3

getBuilderFunction · 0.85
putBuilderFunction · 0.85
StringMethod · 0.45

Tested by 3

TestNilSQLFunction · 0.76
TestTruncateStatementSQLFunction · 0.76