diff --git a/go.mod b/go.mod index 3070294e18f..42697b26a0c 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/labstack/echo/v4 v4.1.16 github.com/labstack/gommon v0.3.0 github.com/laurent22/ical-go v0.1.1-0.20181107184520-7e5d6ade8eef - github.com/lib/pq v1.4.0 + github.com/lib/pq v1.5.0 github.com/mailru/easyjson v0.7.0 // indirect github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect diff --git a/go.sum b/go.sum index 462496e6a3c..e39d0f1043c 100644 --- a/go.sum +++ b/go.sum @@ -255,6 +255,8 @@ github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.4.0 h1:TmtCFbH+Aw0AixwyttznSMQDgbR5Yed/Gg6S8Funrhc= github.com/lib/pq v1.4.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.5.0 h1:Hq6pEflc2Q3hP5iEH3Q6XopXrJXxjhwbvMpj9eZnpp0= +github.com/lib/pq v1.5.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go index bab765bb64d..77c361341e9 100644 --- a/vendor/github.com/lib/pq/conn.go +++ b/vendor/github.com/lib/pq/conn.go @@ -152,6 +152,9 @@ type conn struct { // If not nil, notices will be synchronously sent here noticeHandler func(*Error) + + // If not nil, notifications will be synchronously sent here + notificationHandler func(*Notification) } // Handle driver-side settings in parsed connection string. @@ -977,6 +980,10 @@ func (cn *conn) recv() (t byte, r *readBuf) { if n := cn.noticeHandler; n != nil { n(parseError(r)) } + case 'A': + if n := cn.notificationHandler; n != nil { + n(recvNotification(r)) + } default: return } @@ -994,7 +1001,9 @@ func (cn *conn) recv1Buf(r *readBuf) byte { switch t { case 'A': - // ignore + if n := cn.notificationHandler; n != nil { + n(recvNotification(r)) + } case 'N': if n := cn.noticeHandler; n != nil { n(parseError(r)) diff --git a/vendor/github.com/lib/pq/notify.go b/vendor/github.com/lib/pq/notify.go index 9f61c5f1d26..ff0b04c0d6d 100644 --- a/vendor/github.com/lib/pq/notify.go +++ b/vendor/github.com/lib/pq/notify.go @@ -4,6 +4,7 @@ package pq // This module contains support for Postgres LISTEN/NOTIFY. import ( + "database/sql/driver" "errors" "fmt" "sync" @@ -29,6 +30,16 @@ func recvNotification(r *readBuf) *Notification { return &Notification{bePid, channel, extra} } +// SetNotificationHandler sets the given notification handler on the given +// connection. A runtime panic occurs if c is not a pq connection. A nil handler +// may be used to unset it. +// +// Note: Notification handlers are executed synchronously by pq meaning commands +// won't continue to be processed until the handler returns. +func SetNotificationHandler(c driver.Conn, handler func(*Notification)) { + c.(*conn).notificationHandler = handler +} + const ( connStateIdle int32 = iota connStateExpectResponse diff --git a/vendor/modules.txt b/vendor/modules.txt index 4676b269b18..02fbc10f15c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -118,7 +118,7 @@ github.com/labstack/gommon/log github.com/labstack/gommon/random # github.com/laurent22/ical-go v0.1.1-0.20181107184520-7e5d6ade8eef github.com/laurent22/ical-go -# github.com/lib/pq v1.4.0 +# github.com/lib/pq v1.5.0 github.com/lib/pq github.com/lib/pq/oid github.com/lib/pq/scram