MCPcopy
hub / github.com/jackc/pgx / Decode

Method Decode

pgproto3/execute.go:21–36  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
21func (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.
39func (src *Execute) Encode(dst []byte) ([]byte, error) {

Callers 1

FuzzExecuteFunction · 0.95

Calls 3

Uint32Method · 0.80
LenMethod · 0.65
NextMethod · 0.65

Tested by 1

FuzzExecuteFunction · 0.76