added PortalSuspended message
This commit is contained in:
@@ -23,7 +23,7 @@ type Frontend struct {
|
|||||||
copyInResponse CopyInResponse
|
copyInResponse CopyInResponse
|
||||||
copyOutResponse CopyOutResponse
|
copyOutResponse CopyOutResponse
|
||||||
copyDone CopyDone
|
copyDone CopyDone
|
||||||
copyFail CopyFail
|
copyFail CopyFail
|
||||||
dataRow DataRow
|
dataRow DataRow
|
||||||
emptyQueryResponse EmptyQueryResponse
|
emptyQueryResponse EmptyQueryResponse
|
||||||
errorResponse ErrorResponse
|
errorResponse ErrorResponse
|
||||||
@@ -36,6 +36,7 @@ type Frontend struct {
|
|||||||
parseComplete ParseComplete
|
parseComplete ParseComplete
|
||||||
readyForQuery ReadyForQuery
|
readyForQuery ReadyForQuery
|
||||||
rowDescription RowDescription
|
rowDescription RowDescription
|
||||||
|
portalSuspended PortalSuspended
|
||||||
|
|
||||||
bodyLen int
|
bodyLen int
|
||||||
msgType byte
|
msgType byte
|
||||||
@@ -76,8 +77,8 @@ func (b *Frontend) Receive() (BackendMessage, error) {
|
|||||||
msg = &b.notificationResponse
|
msg = &b.notificationResponse
|
||||||
case 'c':
|
case 'c':
|
||||||
msg = &b.copyDone
|
msg = &b.copyDone
|
||||||
case 'f':
|
case 'f':
|
||||||
msg = &b.copyFail
|
msg = &b.copyFail
|
||||||
case 'C':
|
case 'C':
|
||||||
msg = &b.commandComplete
|
msg = &b.commandComplete
|
||||||
case 'd':
|
case 'd':
|
||||||
@@ -112,6 +113,8 @@ func (b *Frontend) Receive() (BackendMessage, error) {
|
|||||||
msg = &b.copyBothResponse
|
msg = &b.copyBothResponse
|
||||||
case 'Z':
|
case 'Z':
|
||||||
msg = &b.readyForQuery
|
msg = &b.readyForQuery
|
||||||
|
case 's':
|
||||||
|
msg = &b.portalSuspended
|
||||||
default:
|
default:
|
||||||
return nil, errors.Errorf("unknown message type: %c", b.msgType)
|
return nil, errors.Errorf("unknown message type: %c", b.msgType)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package pgproto3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PortalSuspended struct{}
|
||||||
|
|
||||||
|
func (*PortalSuspended) Backend() {}
|
||||||
|
|
||||||
|
func (dst *PortalSuspended) Decode(src []byte) error {
|
||||||
|
if len(src) != 0 {
|
||||||
|
return &invalidMessageLenErr{messageType: "PortalSuspended", expectedLen: 0, actualLen: len(src)}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (src *PortalSuspended) Encode(dst []byte) []byte {
|
||||||
|
return append(dst, 's', 0, 0, 0, 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (src *PortalSuspended) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(struct {
|
||||||
|
Type string
|
||||||
|
}{
|
||||||
|
Type: "PortalSuspended",
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user