aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgx/pgproto3/copy_out_response.go
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2019-10-29 10:58:47 +0000
committerFelix Hanley <felix@userspace.com.au>2019-10-29 10:58:47 +0000
commiteda2530094e72463f6aef6e7f9bf524002e248fa (patch)
tree66e987a6229a159c0eb19c448b3af04db5f56733 /vendor/github.com/jackc/pgx/pgproto3/copy_out_response.go
parentfbc564026fa84c7f9142cdcf60accdf6b5bdaeaf (diff)
downloaddhtsearch-eda2530094e72463f6aef6e7f9bf524002e248fa.tar.gz
dhtsearch-eda2530094e72463f6aef6e7f9bf524002e248fa.tar.bz2
Remove vendored files and create go.mod
Diffstat (limited to 'vendor/github.com/jackc/pgx/pgproto3/copy_out_response.go')
-rw-r--r--vendor/github.com/jackc/pgx/pgproto3/copy_out_response.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/vendor/github.com/jackc/pgx/pgproto3/copy_out_response.go b/vendor/github.com/jackc/pgx/pgproto3/copy_out_response.go
deleted file mode 100644
index eaa33b8..0000000
--- a/vendor/github.com/jackc/pgx/pgproto3/copy_out_response.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package pgproto3
-
-import (
- "bytes"
- "encoding/binary"
- "encoding/json"
-
- "github.com/jackc/pgx/pgio"
-)
-
-type CopyOutResponse struct {
- OverallFormat byte
- ColumnFormatCodes []uint16
-}
-
-func (*CopyOutResponse) Backend() {}
-
-func (dst *CopyOutResponse) Decode(src []byte) error {
- buf := bytes.NewBuffer(src)
-
- if buf.Len() < 3 {
- return &invalidMessageFormatErr{messageType: "CopyOutResponse"}
- }
-
- overallFormat := buf.Next(1)[0]
-
- columnCount := int(binary.BigEndian.Uint16(buf.Next(2)))
- if buf.Len() != columnCount*2 {
- return &invalidMessageFormatErr{messageType: "CopyOutResponse"}
- }
-
- columnFormatCodes := make([]uint16, columnCount)
- for i := 0; i < columnCount; i++ {
- columnFormatCodes[i] = binary.BigEndian.Uint16(buf.Next(2))
- }
-
- *dst = CopyOutResponse{OverallFormat: overallFormat, ColumnFormatCodes: columnFormatCodes}
-
- return nil
-}
-
-func (src *CopyOutResponse) Encode(dst []byte) []byte {
- dst = append(dst, 'H')
- sp := len(dst)
- dst = pgio.AppendInt32(dst, -1)
-
- dst = pgio.AppendUint16(dst, uint16(len(src.ColumnFormatCodes)))
- for _, fc := range src.ColumnFormatCodes {
- dst = pgio.AppendUint16(dst, fc)
- }
-
- pgio.SetInt32(dst[sp:], int32(len(dst[sp:])))
-
- return dst
-}
-
-func (src *CopyOutResponse) MarshalJSON() ([]byte, error) {
- return json.Marshal(struct {
- Type string
- ColumnFormatCodes []uint16
- }{
- Type: "CopyOutResponse",
- ColumnFormatCodes: src.ColumnFormatCodes,
- })
-}