Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Update overview.md #118

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ of a "database" or "schema." It's an abstraction of the interface and existence
of a database, which might be as varied as a local file, accessed through a network
connection, or in-memory and in-process.

`sql.DB` performs some important tasks for you behind the scenes:

* It opens and closes connections to the actual underlying database, via the driver.
* It manages a pool of connections as needed, which may be a variety of things as mentioned.
`sql.DB` differs from equivalent entity in C#, Java or PHP. It creates a handle with empty slice of connections.
Subsequent DB operation (Query, QueryRow, Execute, Ping) creates real conection and pushes it into the slice. The connection
is marked as 'free' after finishing an operation and subsequent one can reuse it instead of creating new connection.
Query is finished after closing 'Rows'. QueryRow, Execute or Ping closes connection immediately. DB object allows some
optimization of the pool calling functions SetMaxOpenConns(), SetMaxIdleConns() and SetConnMaxLifetime(). Details of the optimization are described
on site 'https://www.alexedwards.net/blog/configuring-sqldb'.

The `sql.DB` abstraction is designed to keep you from worrying about how to
manage concurrent access to the underlying datastore. A connection is marked
Expand Down