-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: refactor server code #9
Conversation
@swarit-pandey thanks for this contribution, please resolve the conflicts once. |
@lucifercr07 Sure, will get it done by EOD today. |
config/config.go
Outdated
@@ -14,7 +14,7 @@ type Config struct { | |||
} | |||
|
|||
// LoadConfig loads the application configuration from environment variables or defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn name is self explanatory we can remove or update the comment as required
// LoadConfig loads the application configuration from environment variables or defaults | |
// loads the application configuration from environment variables or defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Go, if a function is public then it should have a comment starting with its name.
Signed-off-by: Swarit Pandey <[email protected]>
Signed-off-by: Swarit Pandey <[email protected]>
Signed-off-by: Swarit Pandey <[email protected]>
// ExecuteCommand executes a command based on the input | ||
func (db *DiceDB) ExecuteCommand(command *cmds.CommandRequest) (interface{}, error) { | ||
switch command.Cmd { | ||
case "GET": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please match the behaviour of current changes similar to this.
@@ -4,3 +4,9 @@ type CommandRequest struct { | |||
Cmd string `json:"cmd"` | |||
Args []string | |||
} | |||
|
|||
type CommandRequestArgs struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required
@@ -0,0 +1,3 @@ | |||
package service | |||
|
|||
// TODO: Implement me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these empty?
@@ -0,0 +1,14 @@ | |||
package repository | |||
|
|||
type GetRequest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep this generic, not feasible to be done for multiple commands getting generated.
Closing the PR, since inactive from sometime. |
Hey folks, sorry for not being able to continue working on this. I got occupied with other work related stuff, thanks for taking time to review. |
Purpose: The current code can be potentially improved to use standard REST based structure used in Go projects. Currently there is no scope of dependency injection, seperation of concerned layers which could potentially create issues going ahead (as we add more routes and businees logic).
This PR overhauls a lot of code that was implemented previously (excpet core logic). The new changes introduces:
Potential improvements:
Caveats:
This is not to undermine the work previous contributors did, if the reviewers/maintainers think that this change is 'very drastic', feel free to close the PR. But since a lot of service layer code is still to be implemented we can potentially improve the code.
Thanks.