Skip to content

Commit

Permalink
database/sql: document Stmt lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
pushrax authored Jan 23, 2019
1 parent 1fb5961 commit 55dba87
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/database/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,13 @@ var (

// Stmt is a prepared statement.
// A Stmt is safe for concurrent use by multiple goroutines.
//
// If a Stmt is prepared on a Tx or Conn, it will be bound to a single
// underlying connection forever. If the Tx or Conn closes, the Stmt will
// become unusable and all operations will return an error.
// If a Stmt is prepared on a DB, it will remain usable for the lifetime of the
// DB. When the Stmt needs to execute on a new underlying connection, it will
// prepare itself on the new connection automatically.
type Stmt struct {
// Immutable:
db *DB // where we came from
Expand Down

0 comments on commit 55dba87

Please sign in to comment.