Update postgres.go

This commit is contained in:
Fenny
2020-11-05 09:07:49 +01:00
parent 3948041f12
commit 1b56ad40f8

View File

@@ -98,7 +98,7 @@ func New(config ...Config) *Storage {
db: db, db: db,
gcInterval: cfg.GCInterval, gcInterval: cfg.GCInterval,
sqlSelect: fmt.Sprintf(`SELECT v, e FROM %s WHERE k=$1;`, cfg.Table), 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 (id) DO UPDATE SET v = $4, e = $5", 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), sqlDelete: fmt.Sprintf("DELETE FROM %s WHERE k=$1", cfg.Table),
sqlClear: fmt.Sprintf("DELETE FROM %s;", cfg.Table), sqlClear: fmt.Sprintf("DELETE FROM %s;", cfg.Table),
sqlGC: fmt.Sprintf("DELETE FROM %s WHERE e <= $1", cfg.Table), sqlGC: fmt.Sprintf("DELETE FROM %s WHERE e <= $1", cfg.Table),