feat: modify pkg
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func TruncateTable(db *gorm.DB, table string) {
|
||||
if db.Dialector.Name() == "postgres" {
|
||||
db.Exec(fmt.Sprintf("TRUNCATE TABLE %s RESTART IDENTITY", table))
|
||||
return
|
||||
}
|
||||
db.Exec(fmt.Sprintf("TRUNCATE TABLE %s", table))
|
||||
func TruncateTable(db *sql.DB, table string) {
|
||||
db.Exec(fmt.Sprintf("TRUNCATE TABLE %s RESTART IDENTITY", table))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user