From 4e7b11d35afe0fa084f6166ddd50a0fa3a14fc36 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Tue, 19 Mar 2019 07:16:10 +0100 Subject: [PATCH] Change placeholders --- cmd/hubserver/storage/postgres.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/hubserver/storage/postgres.go b/cmd/hubserver/storage/postgres.go index 6adb3f4..51380c2 100644 --- a/cmd/hubserver/storage/postgres.go +++ b/cmd/hubserver/storage/postgres.go @@ -25,7 +25,7 @@ func (s *postgres) Close() error { func (s *postgres) Subscribe(topic string, sub Subscriber) error { _, err := s.db.Exec( - `INSERT INTO "subscribers" ("topic", "callback", "lease_seconds", "secret", "created") VALUES (?, ?, ?, ?, now())`, + `INSERT INTO "subscribers" ("topic", "callback", "lease_seconds", "secret", "created") VALUES ($1, $2, $3, $4, now())`, topic, sub.Callback, sub.LeaseSeconds, @@ -36,7 +36,7 @@ func (s *postgres) Subscribe(topic string, sub Subscriber) error { func (s *postgres) Unsubscribe(topic, callback string) error { _, err := s.db.Exec( - `DELETE FROM "subscribers" WHERE "topic" = ? AND "callback" = ?`, + `DELETE FROM "subscribers" WHERE "topic" = ? AND "callback" = $1`, topic, callback, )