chengxilo commented on code in PR #1916:
URL: https://github.com/apache/iggy/pull/1916#discussion_r2181530658
##########
foreign/go/binary_serialization/binary_request_serializer.go:
##########
@@ -24,32 +24,41 @@ import (
)
func CreateGroup(request CreateConsumerGroupRequest) []byte {
+ if request.ConsumerGroupId == nil {
+ request.ConsumerGroupId = new(uint32)
+ }
customIdOffset := 4 + request.StreamId.Length + request.TopicId.Length
bytes := make([]byte,
4+request.StreamId.Length+request.TopicId.Length+1+4+len(request.Name))
copy(bytes[0:customIdOffset], SerializeIdentifiers(request.StreamId,
request.TopicId))
- binary.LittleEndian.PutUint32(bytes[customIdOffset:customIdOffset+4],
uint32(request.ConsumerGroupId))
+ binary.LittleEndian.PutUint32(bytes[customIdOffset:customIdOffset+4],
*request.ConsumerGroupId)
bytes[customIdOffset+4] = byte(len(request.Name))
- copy(bytes[customIdOffset+5:], []byte(request.Name))
+ copy(bytes[customIdOffset+5:], request.Name)
return bytes
}
-func UpdateOffset(request StoreOffsetRequest) []byte {
+func UpdateOffset(request StoreConsumerOffsetRequest) []byte {
+ if request.PartitionId == nil {
+ request.PartitionId = new(uint32)
+ }
Review Comment:
when the partitionId is nil, assign it with `new(uint32)` i.e. 0. For all of
optional arguments like this. When we do the serialization, I give them a
default value the same as rust sdk. It's a temporary solution, maybe it should
be enhanced in the future as the code doesn't look great.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]