chengxilo opened a new pull request, #2737:
URL: https://github.com/apache/iggy/pull/2737

   ## Which issue does this PR close?
   
   Closes # N/A
   
   ---
   
   ## Rationale
   
   Currently, the Go client performs web requests by calling:
   
   ```go
   func (c *IggyTcpClient) sendAndFetchResponse(message []byte, command 
iggcon.CommandCode) ([]byte, error)
   ```
   
   While this works, it tightly couples request serialization and command code 
handling at the call site, making the API less expressive and harder to extend.
   
   ---
   
   ## What changed?
   
   This PR depends on https://github.com/apache/iggy/pull/2580.
   
   Previously, each web request manually passed serialized bytes together with 
a `CommandCode` into `sendAndFetchResponse`, requiring callers to manage both 
serialization and command metadata.
   
   Now, we use:
   
   ```go
   func (c *IggyTcpClient) do(cmd iggcon.Command) ([]byte, error)
   ```
   
   Request types implement a new `Command` interface that:
   
   - Supports binary serialization (Implement `MarshalBinary` method)
   - Provides a `Code()` method to return the associated command code  
   
   This moves command metadata and serialization logic into the request type 
itself, improving encapsulation, readability, and extensibility.
   
   ---
   
   ## Local Execution
   
   - Passed locally  
   - Pre-commit hooks ran  
   
   Not ready for review yet.
   
   ---
   
   ## AI Usage
   
   - Tool: GitHub Copilot  and ChatGPT
   - Scope: Copilot is for autocomplete assistance only. I use ChatGPT to help 
with writing(Yeah this pr)  
   - Verification: All changes were compiled and tested locally  
   - Yes, I can explain every line of the implementation if needed.
   


-- 
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]

Reply via email to