1
0
mirror of https://github.com/golang/go synced 2024-11-23 14:00:03 -07:00

database/sql: clarify behavior of DB.Close

It wasn't clear for existing docs if DB.Close forcefully closed
connections or waited for them to finish.

Fixes #23753

Change-Id: Id7df31224c93181c8d01bab7b0b23da25b42a288
Reviewed-on: https://go-review.googlesource.com/103397
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Daniel Theophanes 2018-03-29 10:01:27 -07:00
parent 8e43c37229
commit 7a7b63f3e7

View File

@ -738,7 +738,9 @@ func (db *DB) Ping() error {
return db.PingContext(context.Background()) return db.PingContext(context.Background())
} }
// Close closes the database, releasing any open resources. // Close closes the database and prevents new queries from starting.
// Close then waits for all queries that have started processing on the server
// to finish.
// //
// It is rare to Close a DB, as the DB handle is meant to be // It is rare to Close a DB, as the DB handle is meant to be
// long-lived and shared between many goroutines. // long-lived and shared between many goroutines.