package pgproto3

import (
	
	
	

	
)

type CopyBothResponse struct {
	OverallFormat     byte
	ColumnFormatCodes []uint16
}
Backend identifies this message as sendable by the PostgreSQL backend.
Decode decodes src into dst. src must contain the complete message with the exception of the initial 1 byte message type identifier and 4 byte message length.
func ( *CopyBothResponse) ( []byte) error {
	 := bytes.NewBuffer()

	if .Len() < 3 {
		return &invalidMessageFormatErr{messageType: "CopyBothResponse"}
	}

	 := .Next(1)[0]

	 := int(binary.BigEndian.Uint16(.Next(2)))
	if .Len() != *2 {
		return &invalidMessageFormatErr{messageType: "CopyBothResponse"}
	}

	 := make([]uint16, )
	for  := 0;  < ; ++ {
		[] = binary.BigEndian.Uint16(.Next(2))
	}

	* = CopyBothResponse{OverallFormat: , ColumnFormatCodes: }

	return nil
}
Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.
func ( *CopyBothResponse) ( []byte) []byte {
	 = append(, 'W')
	 := len()
	 = pgio.AppendInt32(, -1)

	 = pgio.AppendUint16(, uint16(len(.ColumnFormatCodes)))
	for ,  := range .ColumnFormatCodes {
		 = pgio.AppendUint16(, )
	}

	pgio.SetInt32([:], int32(len([:])))

	return 
}
MarshalJSON implements encoding/json.Marshaler.
func ( CopyBothResponse) () ([]byte, error) {
	return json.Marshal(struct {
		              string
		 []uint16
	}{
		:              "CopyBothResponse",
		: .ColumnFormatCodes,
	})