@@ -69,15 +69,19 @@ func Connect(addr string, user string, password string, dbName string, options .
69
69
ctx , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
70
70
defer cancel ()
71
71
72
- dialer := & net.Dialer {}
72
+ return ConnectWithContext (ctx , addr , user , password , dbName , options ... )
73
+ }
73
74
75
+ // ConnectWithContext to a MySQL addr using the provided context.
76
+ func ConnectWithContext (ctx context.Context , addr string , user string , password string , dbName string , options ... func (* Conn )) (* Conn , error ) {
77
+ dialer := & net.Dialer {}
74
78
return ConnectWithDialer (ctx , "" , addr , user , password , dbName , dialer .DialContext , options ... )
75
79
}
76
80
77
81
// Dialer connects to the address on the named network using the provided context.
78
82
type Dialer func (ctx context.Context , network , address string ) (net.Conn , error )
79
83
80
- // Connect to a MySQL server using the given Dialer.
84
+ // ConnectWithDialer to a MySQL server using the given Dialer.
81
85
func ConnectWithDialer (ctx context.Context , network string , addr string , user string , password string , dbName string , dialer Dialer , options ... func (* Conn )) (* Conn , error ) {
82
86
c := new (Conn )
83
87
0 commit comments