Skip to content
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

optimize the mysql connection state check logic #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RaymRaym
Copy link

First, nice project. I learned a lot about golnag web development and react.js from it. Thank you.
Next, when I do project initialization, I found the logic of mysql connection creation part is not complete. The sql.Open method only validate the arguments but it does not verify the cconnection. So only after you check the connection by calling db.Ping(), can you print "Successfully connected to MySQL database". Following is the comment from sql package source code.

// Open may just validate its arguments without creating a connection
// to the database. To verify that the data source name is valid, call
// Ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant