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.
(src []byte)
| 19 | // Decode decodes src into dst. src must contain the complete message with the exception of the initial 1 byte message |
| 20 | // type identifier and 4 byte message length. |
| 21 | func (dst *Execute) Decode(src []byte) error { |
| 22 | buf := bytes.NewBuffer(src) |
| 23 | |
| 24 | b, err := buf.ReadBytes(0) |
| 25 | if err != nil { |
| 26 | return err |
| 27 | } |
| 28 | dst.Portal = string(b[:len(b)-1]) |
| 29 | |
| 30 | if buf.Len() < 4 { |
| 31 | return &invalidMessageFormatErr{messageType: "Execute"} |
| 32 | } |
| 33 | dst.MaxRows = binary.BigEndian.Uint32(buf.Next(4)) |
| 34 | |
| 35 | return nil |
| 36 | } |
| 37 | |
| 38 | // Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length. |
| 39 | func (src *Execute) Encode(dst []byte) ([]byte, error) { |