mirror of
https://github.com/gofiber/storage.git
synced 2025-10-04 16:22:52 +08:00
refactor: use TRUNCATE to reset the tables for postgres/ mysql (#74)
MySQL docs: https://dev.mysql.com/doc/refman/8.0/en/truncate-table.html Postgres docs: https://www.postgresql.org/docs/current/sql-truncate.html
This commit is contained in:
@@ -81,7 +81,7 @@ func New(config ...Config) *Storage {
|
||||
sqlSelect: fmt.Sprintf("SELECT v, e FROM %s WHERE k=?;", cfg.Table),
|
||||
sqlInsert: fmt.Sprintf("INSERT INTO %s (k, v, e) VALUES (?,?,?) ON DUPLICATE KEY UPDATE v = ?, e = ?", cfg.Table),
|
||||
sqlDelete: fmt.Sprintf("DELETE FROM %s WHERE k=?", cfg.Table),
|
||||
sqlReset: fmt.Sprintf("DELETE FROM %s;", cfg.Table),
|
||||
sqlReset: fmt.Sprintf("TRUNCATE TABLE %s;", cfg.Table),
|
||||
sqlGC: fmt.Sprintf("DELETE FROM %s WHERE e <= ? AND e != 0", cfg.Table),
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user