| 
														
															@@ -1,6 +1,7 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 package db 
														 | 
														
														 | 
														
															 package db 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import ( 
														 | 
														
														 | 
														
															 import ( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	"context" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"database/sql" 
														 | 
														
														 | 
														
															 	"database/sql" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"fmt" 
														 | 
														
														 | 
														
															 	"fmt" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"sync" 
														 | 
														
														 | 
														
															 	"sync" 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -94,9 +95,11 @@ func (d *DB) Connect() (err error) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // Close close database connect 
														 | 
														
														 | 
														
															 // Close close database connect 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-func (d *DB) Close() { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	// use pool 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	//d.c.Close() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+func (d *DB) Close() error { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	if d.c != nil { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		return d.c.Close() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	return nil 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // Ping verifies a connection to the database is still alive, establishing a connection if necessary. 
														 | 
														
														 | 
														
															 // Ping verifies a connection to the database is still alive, establishing a connection if necessary. 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -104,6 +107,11 @@ func (d *DB) Ping() error { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	return d.c.Ping() 
														 | 
														
														 | 
														
															 	return d.c.Ping() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+// PingContext verifies a connection to the database is still alive, establishing a connection if necessary. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+func (d *DB) PingContext(ctx context.Context) error { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	return d.c.PingContext(ctx) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // Stats returns database statistics. 
														 | 
														
														 | 
														
															 // Stats returns database statistics. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 func (d *DB) Stats() sql.DBStats { 
														 | 
														
														 | 
														
															 func (d *DB) Stats() sql.DBStats { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	return d.c.Stats() 
														 | 
														
														 | 
														
															 	return d.c.Stats() 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -292,6 +300,16 @@ func Ping() error { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	return defaultDb.Ping() 
														 | 
														
														 | 
														
															 	return defaultDb.Ping() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+// PingContext verifies a connection to the database is still alive, establishing a connection if necessary. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+func PingContext(ctx context.Context) error { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	return defaultDb.PingContext(ctx) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+// Close close database connect 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+func Close() error { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	return defaultDb.Close() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // Stats returns database statistics. 
														 | 
														
														 | 
														
															 // Stats returns database statistics. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 func Stats() sql.DBStats { 
														 | 
														
														 | 
														
															 func Stats() sql.DBStats { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	return defaultDb.Stats() 
														 | 
														
														 | 
														
															 	return defaultDb.Stats() 
														 |