-
Notifications
You must be signed in to change notification settings - Fork 77
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
Implement grpc create user #192
Conversation
Use real storage.User struct.
cmd/client/cmd/user.go
Outdated
@@ -99,12 +88,45 @@ func deleteUser(cmd *cobra.Command, args []string) { | |||
fmt.Println("User deleted") | |||
} | |||
|
|||
func createUser(cmd *cobra.Command, args []string) { | |||
name, _ := cmd.Flags().GetString("name") |
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.
Are we just ignoring errors on all input parsing?
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.
copy pasta from previous PR's, I will take a look into it
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.
I wouldn't do it now.
We can check for unexpected input errors in another PR.
pkg/server/user/user.go
Outdated
if err := dbu.DB.Save(u).Error; err != nil { | ||
return err | ||
} | ||
return nil |
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.
what about:
- if err := dbu.DB.Save(u).Error; err != nil {
- return err
- }
- return nil
+ return dbu.DB.Save(u).Error
?
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.
Oh boy 👍
e8eae1c
to
3eb1d9a
Compare
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.
LGTM 👍
This change is