Source File
copy_out_response.go
Belonging Package
github.com/jackc/pgproto3/v2
package pgproto3
import (
)
type CopyOutResponse struct {
OverallFormat byte
ColumnFormatCodes []uint16
}
func (*CopyOutResponse) () {}
func ( *CopyOutResponse) ( []byte) error {
:= bytes.NewBuffer()
if .Len() < 3 {
return &invalidMessageFormatErr{messageType: "CopyOutResponse"}
}
:= .Next(1)[0]
:= int(binary.BigEndian.Uint16(.Next(2)))
if .Len() != *2 {
return &invalidMessageFormatErr{messageType: "CopyOutResponse"}
}
:= make([]uint16, )
for := 0; < ; ++ {
[] = binary.BigEndian.Uint16(.Next(2))
}
* = CopyOutResponse{OverallFormat: , ColumnFormatCodes: }
return nil
}
func ( *CopyOutResponse) ( []byte) []byte {
= append(, 'H')
:= len()
= pgio.AppendInt32(, -1)
= append(, .OverallFormat)
= pgio.AppendUint16(, uint16(len(.ColumnFormatCodes)))
for , := range .ColumnFormatCodes {
= pgio.AppendUint16(, )
}
pgio.SetInt32([:], int32(len([:])))
return
}
func ( CopyOutResponse) () ([]byte, error) {
return json.Marshal(struct {
string
[]uint16
}{
: "CopyOutResponse",
: .ColumnFormatCodes,
})
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |