build(deps): bump github.com/jackc/pgtype from 1.7.0 to 1.8.1
Bumps [github.com/jackc/pgtype](https://github.com/jackc/pgtype) from 1.7.0 to 1.8.1. - [Release notes](https://github.com/jackc/pgtype/releases) - [Changelog](https://github.com/jackc/pgtype/blob/master/CHANGELOG.md) - [Commits](https://github.com/jackc/pgtype/compare/v1.7.0...v1.8.1) --- updated-dependencies: - dependency-name: github.com/jackc/pgtype dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
97d6142609
commit
9ceeaa1dfd
205 changed files with 17496 additions and 13126 deletions
25
vendor/github.com/jackc/pgproto3/v2/close.go
generated
vendored
25
vendor/github.com/jackc/pgproto3/v2/close.go
generated
vendored
|
|
@ -3,6 +3,7 @@ package pgproto3
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/jackc/pgio"
|
||||
)
|
||||
|
|
@ -62,3 +63,27 @@ func (src Close) MarshalJSON() ([]byte, error) {
|
|||
Name: src.Name,
|
||||
})
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements encoding/json.Unmarshaler.
|
||||
func (dst *Close) UnmarshalJSON(data []byte) error {
|
||||
// Ignore null, like in the main JSON package.
|
||||
if string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
|
||||
var msg struct {
|
||||
ObjectType string
|
||||
Name string
|
||||
}
|
||||
if err := json.Unmarshal(data, &msg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(msg.ObjectType) != 1 {
|
||||
return errors.New("invalid length for Close.ObjectType")
|
||||
}
|
||||
|
||||
dst.ObjectType = byte(msg.ObjectType[0])
|
||||
dst.Name = msg.Name
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue