I am currently making a simple API using GAE+CloudSQL.
We tried to implement an API that could retrieve all DB data and created the following code:
However, if you implement this and hit the API, nothing will be printed.
After investigating the cause,
After the people in , the number of elements in the array matched the number of data in the DB, but the contents were all empty or zero.
I have no idea if there is a problem with the implementation or GCP configuration.
Please tell me the solution.Thank you for your cooperation.
Sorry, I made a simple mistake.
As it was written, the DB connection will be lost after this function is executed.
Correct the code and write db.Close() directly below the main statement.
I was able to get both person.Name and person.Age.
Since there is no column name specified in the format , you cannot map rows retrieved from the database to a structure, and all elements appear to be empty. What do you think?
© 2022 OneMinuteCode. All rights reserved.