PradyumnaKrishna / enigma-protocol

An end to end encrypted messenger using Flask, SocketIO, and Vue.js
https://protocol.onpy.in
MIT License
19 stars 34 forks source link

Changes in Backend Go code ('db' package) #101

Closed itsmeabhishek03 closed 4 months ago

itsmeabhishek03 commented 4 months ago

Hey @PradyumnaKrishna have made a few suggestions for improvements in your go code -

1)QueryRow instead of Query: We can used QueryRow instead of Query in the GetPublicKey function since you're expecting only one row. This simplifies the code and is more efficient.

2)Named Return Values: i can modify the NewConn function to use named return values. This makes it clear what the function is returning and improves code readability.

3)Consistent Error Return: I can modified the SaveUser function to return an error. This ensures that you can handle errors in the calling code, providing a more robust implementation.

4)Error Handling: I can add error handling throughout the code. It's essential to handle errors appropriately to prevent unexpected crashes and to provide meaningful error messages.

These changes aim to enhance the reliability, clarity, and maintainability of the codebase. Please review and let me know if any further adjustments are needed. Also, please assign this issue under codepeak'23.

PradyumnaKrishna commented 4 months ago

Sure you're welcome to contribute.