Encode encodes src into dst. dst will include the 4 byte message length.
(dst []byte)
| 41 | |
| 42 | // Encode encodes src into dst. dst will include the 4 byte message length. |
| 43 | func (src *CancelRequest) Encode(dst []byte) ([]byte, error) { |
| 44 | if len(src.SecretKey) > 256 { |
| 45 | return nil, errors.New("secret key too long") |
| 46 | } |
| 47 | msgLen := int32(12 + len(src.SecretKey)) |
| 48 | dst = pgio.AppendInt32(dst, msgLen) |
| 49 | dst = pgio.AppendInt32(dst, cancelRequestCode) |
| 50 | dst = pgio.AppendUint32(dst, src.ProcessID) |
| 51 | dst = append(dst, src.SecretKey...) |
| 52 | return dst, nil |
| 53 | } |
| 54 | |
| 55 | // MarshalJSON implements encoding/json.Marshaler. |
| 56 | func (src CancelRequest) MarshalJSON() ([]byte, error) { |
nothing calls this directly
no test coverage detected