mirror of
https://github.com/gofiber/storage.git
synced 2025-10-04 08:16:36 +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:
@@ -99,7 +99,7 @@ func New(config ...Config) *Storage {
|
||||
sqlSelect: fmt.Sprintf(`SELECT v, e FROM %s WHERE k=$1;`, cfg.Table),
|
||||
sqlInsert: fmt.Sprintf("INSERT INTO %s (k, v, e) VALUES ($1, $2, $3) ON CONFLICT (k) DO UPDATE SET v = $4, e = $5", cfg.Table),
|
||||
sqlDelete: fmt.Sprintf("DELETE FROM %s WHERE k=$1", 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 <= $1 AND e != 0", cfg.Table),
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user