The _______ method in the database/sql package is used to close a database connection.
- Close
- Exec
- Query
- Prepare
The correct option is Close. In Go's database/sql package, the Close method is used to close a database connection. It's important to close the connection properly to release resources and avoid leaks.
Loading...
Related Quiz
- How does database migration help in managing database schema changes in a project?
- Explain how mocking can be used to isolate external dependencies during testing.
- Gorm provides the _______ function to execute raw SQL queries directly.
- You are implementing a RESTful API for a legacy system. What challenges might you face in implementing CRUD operations and how would you overcome them?
- Your team is new to Go programming, and you want to introduce a testing framework that is easy to learn and provides clear and concise test output. Which testing framework would be most suitable for this scenario?