Add internal sessions manager

This commit is contained in:
Dan Sosedoff
2022-12-02 13:36:31 -06:00
parent d8ee50ece6
commit 9074d4bfb8
6 changed files with 147 additions and 55 deletions

View File

@@ -34,7 +34,8 @@ type Client struct {
serverVersion string
serverType string
lastQueryTime time.Time
External bool
closed bool
External bool `json:"external"`
History []history.Record `json:"history"`
ConnectionString string `json:"connection_string"`
}
@@ -423,6 +424,13 @@ func (client *Client) query(query string, args ...interface{}) (*Result, error)
// Close database connection
func (client *Client) Close() error {
if client.closed {
return nil
}
defer func() {
client.closed = true
}()
if client.tunnel != nil {
client.tunnel.Close()
}