-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add DB and docker #2
Conversation
cmd/user/main.go
Outdated
|
||
query, args, err := builderInsert.ToSql() | ||
if err != nil { | ||
log.Fatalf("failed to build query: %v", err) |
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.
ронять прод не очень хорошее дело))
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.
Заменила Fatalf на просто печать сообщения и возврат ошибки без завершения работы приложения.
cmd/user/main.go
Outdated
// Hashing the password. | ||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(req.GetPassword()), bcryptCost) | ||
if err != nil { | ||
panic(err) |
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.
сомнительно конечно панику кидать, лучше ошибку вернуть)
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.
Заменила panic на просто печать сообщения и возврат ошибки без завершения работы приложения.
cmd/user/main.go
Outdated
if err != nil { | ||
log.Fatalf("failed to generate ID: %v", err) | ||
log.Fatalf("failed to create user: %v", err) |
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.
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.
Заменила Fatalf на просто печать сообщения и возврат ошибки без завершения работы приложения.
cmd/user/main.go
Outdated
|
||
query, args, err := builderSelect.ToSql() | ||
if err != nil { | ||
log.Fatalf("failed to build query: %v", err) |
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.
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.
Заменила Fatalf на просто печать сообщения и возврат ошибки без завершения работы приложения.
cmd/user/main.go
Outdated
if err == pgx.ErrNoRows { | ||
return nil, err | ||
} | ||
log.Fatalf("failed to select user: %v", err) |
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.
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.
Заменила Fatalf на просто печать сообщения и возврат ошибки без завершения работы приложения.
cmd/user/main.go
Outdated
|
||
query, args, err := builderUpdate.ToSql() | ||
if err != nil { | ||
log.Fatalf("failed to build query: %v", err) |
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.
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.
Заменила Fatalf на просто печать сообщения и возврат ошибки без завершения работы приложения.
cmd/user/main.go
Outdated
|
||
s.pool.QueryRow(ctx, query, args...) |
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.
а ошибку обработать?
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.
Заменила на Exec с последующей обработкой ошибки.
cmd/user/main.go
Outdated
log.Fatalf("failed to build query: %v", err) | ||
} | ||
|
||
s.pool.QueryRow(ctx, query, args...) |
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.
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.
Заменила на Exec с последующей обработкой ошибки.
cmd/user/main.go
Outdated
|
||
query, args, err := builderDelete.ToSql() | ||
if err != nil { | ||
log.Fatalf("failed to build query: %v", err) |
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.
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.
Заменила Fatalf на просто печать сообщения и возврат ошибки без завершения работы приложения.
Added: