MCPcopy Create free account
hub / github.com/cloudflare/cfssl / Truncate

Function Truncate

certdb/testdb/testdb.go:92–113  ·  view source on GitHub ↗

Truncate truncates the DB

(db *sqlx.DB)

Source from the content-addressed store, hash-verified

90
91// Truncate truncates the DB
92func Truncate(db *sqlx.DB) {
93 var sql []string
94 switch db.DriverName() {
95 case "mysql":
96 sql = strings.Split(mysqlTruncateTables, "\n")
97 case "postgres":
98 sql = []string{pgTruncateTables}
99 case "sqlite3":
100 sql = []string{sqliteTruncateTables}
101 default:
102 panic("Unknown driver")
103 }
104
105 for _, expr := range sql {
106 if len(strings.TrimSpace(expr)) == 0 {
107 continue
108 }
109 if _, err := db.Exec(expr); err != nil {
110 panic(err)
111 }
112 }
113}

Callers 4

TruncateMethod · 0.92
MySQLDBFunction · 0.85
PostgreSQLDBFunction · 0.85
SQLiteDBFunction · 0.85

Calls

no outgoing calls

Tested by 1

TruncateMethod · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…