Skip to content

Commit cf6aeee

Browse files
feat: change the connector dialer
1 parent 006a3f4 commit cf6aeee

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func DialOpen(d Dialer, dsn string) (_ driver.Conn, err error) {
322322
if err != nil {
323323
return nil, err
324324
}
325-
c.dialer = d
325+
c.Dialer(d)
326326
return c.open(context.Background())
327327
}
328328

connector.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func (c *Connector) Connect(ctx context.Context) (driver.Conn, error) {
2727
return c.open(ctx)
2828
}
2929

30+
// Dialer allows change the dialer used to open connections.
31+
func (c *Connector) Dialer(dialer Dialer) {
32+
c.dialer = dialer
33+
}
34+
3035
// Driver returns the underlying driver of this Connector.
3136
func (c *Connector) Driver() driver.Driver {
3237
return &Driver{}

0 commit comments

Comments
 (0)