beginMessage begins a new message of type t. It appends the message type and a placeholder for the message length to dst. It returns the new buffer and the position of the message length placeholder.
(dst []byte, t byte)
| 102 | // beginMessage begins a new message of type t. It appends the message type and a placeholder for the message length to |
| 103 | // dst. It returns the new buffer and the position of the message length placeholder. |
| 104 | func beginMessage(dst []byte, t byte) ([]byte, int) { |
| 105 | dst = append(dst, t) |
| 106 | sp := len(dst) |
| 107 | dst = pgio.AppendInt32(dst, -1) |
| 108 | return dst, sp |
| 109 | } |
| 110 | |
| 111 | // finishMessage finishes a message that was started with beginMessage. It computes the message length and writes it to |
| 112 | // dst[sp]. If the message length is too large it returns an error. Otherwise it returns the final message buffer. |
no test coverage detected