wolfstudy commented on a change in pull request #3904: [go schema] support go 
schema for pulsar-client-go
URL: https://github.com/apache/pulsar/pull/3904#discussion_r277194917
 
 

 ##########
 File path: pulsar-client-go/pulsar/message.go
 ##########
 @@ -66,6 +69,9 @@ type Message interface {
 
        // Get the key of the message, if any
        Key() string
+
+       //Get the de-serialized value of the message, according the configured
+       GetValue(v interface{}) error
 
 Review comment:
   Here, I want to maintain my point of view. The reason is as follows: in 
Schema interface, we define the decode interface is: `Decode(data []byte, v 
interface{}) error`, consistent with the decode interface, more convenient for 
our processing. in addition, this approach is in line with the design of go.
   
   in java, when we define decode, input is []byte, output is interface.
   
   ```
   default T decode(byte[] bytes)
   ```
   
   But in go, input is []byte and interface, output is error. 
   
   ```
   Decode(data []byte, v interface{}) error
   ```
   
   So, I think the interface should be a parameter of `Value`, not a return.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to