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

Method Encode

pgproto3/function_call_response.go:42–53  ·  view source on GitHub ↗

Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.

(dst []byte)

Source from the content-addressed store, hash-verified

40
41// Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.
42func (src *FunctionCallResponse) Encode(dst []byte) ([]byte, error) {
43 dst, sp := beginMessage(dst, 'V')
44
45 if src.Result == nil {
46 dst = pgio.AppendInt32(dst, -1)
47 } else {
48 dst = pgio.AppendInt32(dst, int32(len(src.Result)))
49 dst = append(dst, src.Result...)
50 }
51
52 return finishMessage(dst, sp)
53}
54
55// MarshalJSON implements encoding/json.Marshaler.
56func (src FunctionCallResponse) MarshalJSON() ([]byte, error) {

Callers

nothing calls this directly

Calls 3

AppendInt32Function · 0.92
beginMessageFunction · 0.85
finishMessageFunction · 0.85

Tested by

no test coverage detected