Automatically close idle sessions

This commit is contained in:
Dan Sosedoff
2017-09-22 22:44:32 -05:00
parent 85e38c390c
commit 62d88121cd
3 changed files with 54 additions and 0 deletions

View File

@@ -363,6 +363,10 @@ func (client *Client) Close() error {
return nil
}
func (client *Client) IsIdle() bool {
return time.Since(client.lastQueryTime).Hours() > 1
}
// Fetch all rows as strings for a single column
func (client *Client) fetchRows(q string) ([]string, error) {
res, err := client.query(q)