package pgproto3
import (
)
type Execute struct {
Portal string
MaxRows uint32
}
func (*Execute) () {}
func ( *Execute) ( []byte) error {
:= bytes.NewBuffer()
, := .ReadBytes(0)
if != nil {
return
}
.Portal = string([:len()-1])
if .Len() < 4 {
return &invalidMessageFormatErr{messageType: "Execute"}
}
.MaxRows = binary.BigEndian.Uint32(.Next(4))
return nil
}
func ( *Execute) ( []byte) ([]byte, error) {
, := beginMessage(, 'E')
= append(, .Portal...)
= append(, 0)
= pgio.AppendUint32(, .MaxRows)
return finishMessage(, )
}
func ( Execute) () ([]byte, error) {
return json.Marshal(struct {
string
string
uint32
}{
: "Execute",
: .Portal,
: .MaxRows,
})
}