Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.
(dst []byte)
| 54 | |
| 55 | // Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length. |
| 56 | func (src *NegotiateProtocolVersion) Encode(dst []byte) ([]byte, error) { |
| 57 | dst, sp := beginMessage(dst, 'v') |
| 58 | dst = pgio.AppendUint32(dst, src.NewestMinorProtocol) |
| 59 | dst = pgio.AppendUint32(dst, uint32(len(src.UnrecognizedOptions))) |
| 60 | for _, option := range src.UnrecognizedOptions { |
| 61 | dst = append(dst, option...) |
| 62 | dst = append(dst, 0) |
| 63 | } |
| 64 | return finishMessage(dst, sp) |
| 65 | } |
| 66 | |
| 67 | // MarshalJSON implements encoding/json.Marshaler. |
| 68 | func (src NegotiateProtocolVersion) MarshalJSON() ([]byte, error) { |