// Encode do thrift message encode.
// Notice! msg must be XXXArgs/XXXResult that the wrap struct for args and result, not the actual args or result
// Notice! seqID will be reset in kitex if the buffer is used for generic call, set seqID=0 is suggested when you call this method.
Encode do thrift message encode.
Notice. msg must be XXXArgs/XXXResult that the wrap struct for args and result, not the actual args or result
Notice. seqID will be reset in kitex if the buffer is used for generic call, set seqID=0 is suggested when you call this method.
// Encode do thrift message encode . // Notice! msg must be XXXArgs / XXXResult that the wrap struct for args and result not the actual args or result // Notice! seqID will be reset in kitex if the buffer is used for generic call set seqID = 0 is suggested when you call this method .
func (t *ThriftMessageCodec) Encode(method string, msgType thrift.TMessageType, seqID int32, msg thrift.TStruct) (b []byte, err error) {
	if method == "" {
		return nil, errors.New("empty methodName in thrift RPCEncode")
	}
	t.tb.Reset()
	if err = t.tProt.WriteMessageBegin(method, msgType, seqID); err != nil {
		return
	}
	if err = msg.Write(t.tProt); err != nil {
		return
	}
	if err = t.tProt.WriteMessageEnd(); err != nil {
		return
	}
	b = append(b, t.tb.Bytes()...)
	return
}
func ( t * ThriftMessageCodec ) Encode ( method string , msgType thrift . TMessageType , seqID int32 , msg thrift . TStruct ) ( b [ ] byte , err error ) { if method == " " { return nil , errors . New ( " " ) } t . tb . Reset ( ) if err = t . tProt . WriteMessageBegin ( method , msgType , seqID ) ; err != nil { return } if err = msg . Write ( t . tProt ) ; err != nil { return } if err = t . tProt . WriteMessageEnd ( ) ; err != nil { return } b = append ( b , t . tb . Bytes ( ) ... ) return }
Encode do thrift message encode.
Encode do thrift message encode .