2
0

json: fix implementation of json Unmarshalers.

* AuthenticationMD5Password was wrong and is not needed
* Bind was wrong
* ErrorResponse is not needed
* Minor improvements for reliability
This commit is contained in:
Henrique Vicente
2021-05-17 02:11:29 +02:00
committed by Jack Christensen
parent ba924e5715
commit 9c2c389e06
7 changed files with 530 additions and 106 deletions
+6 -8
View File
@@ -201,15 +201,13 @@ func (dst *Bind) UnmarshalJSON(data []byte) error {
if err != nil {
return err
}
bind := &Bind{
DestinationPortal: msg.DestinationPortal,
PreparedStatement: msg.PreparedStatement,
ParameterFormatCodes: msg.ParameterFormatCodes,
Parameters: make([][]byte, len(msg.Parameters)),
ResultFormatCodes: msg.ResultFormatCodes,
}
dst.DestinationPortal = msg.DestinationPortal
dst.PreparedStatement = msg.PreparedStatement
dst.ParameterFormatCodes = msg.ParameterFormatCodes
dst.Parameters = make([][]byte, len(msg.Parameters))
dst.ResultFormatCodes = msg.ResultFormatCodes
for n, parameter := range msg.Parameters {
bind.Parameters[n], err = getValueFromJSON(parameter)
dst.Parameters[n], err = getValueFromJSON(parameter)
if err != nil {
return fmt.Errorf("cannot get param %d: %w", n, err)
}