From 7639bdbb99b4171f67aee60ea33902bd21a5c13b Mon Sep 17 00:00:00 2001 From: Gediminas Bukauskas Date: Mon, 15 Aug 2022 13:37:58 +0300 Subject: [PATCH] Update overview.md Description of connection isn't correct. I put more precise description of the process. --- overview.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/overview.md b/overview.md index 337973b..360c1de 100644 --- a/overview.md +++ b/overview.md @@ -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