2
0

Fix json marshal/unmarshal implementations

Fix marshal/unmarshal for:
- authentication_{cleartext_password, md5_password, ok, sasl, sasl_continue, sasl_final}
- error_response
This commit is contained in:
Yuli Khodorkovskiy
2021-05-27 14:47:56 -04:00
committed by Jack Christensen
parent 9c2c389e06
commit 28c20e93c0
8 changed files with 264 additions and 8 deletions
+10
View File
@@ -2,6 +2,7 @@ package pgproto3
import (
"encoding/binary"
"encoding/json"
"errors"
"github.com/jackc/pgio"
@@ -37,3 +38,12 @@ func (src *AuthenticationOk) Encode(dst []byte) []byte {
dst = pgio.AppendUint32(dst, AuthTypeOk)
return dst
}
// MarshalJSON implements encoding/json.Marshaler.
func (src AuthenticationOk) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Type string
}{
Type: "AuthenticationOK",
})
}