@@ -35,24 +35,25 @@ var (
3535// If a new Config is created instead of being parsed from a DSN string,
3636// the NewConfig function should be used, which sets default values.
3737type Config struct {
38- User string // Username
39- Passwd string // Password (requires User)
40- Net string // Network (e.g. "tcp", "tcp6", "unix". default: "tcp")
41- Addr string // Address (default: "127.0.0.1:3306" for "tcp" and "/tmp/mysql.sock" for "unix")
42- DBName string // Database name
43- Params map [string ]string // Connection parameters
44- ConnectionAttributes string // Connection Attributes, comma-delimited string of user-defined "key:value" pairs
45- Collation string // Connection collation
46- Loc * time.Location // Location for time.Time values
47- MaxAllowedPacket int // Max packet size allowed
48- ServerPubKey string // Server public key name
49- pubKey * rsa.PublicKey // Server public key
50- TLSConfig string // TLS configuration name
51- TLS * tls.Config // TLS configuration, its priority is higher than TLSConfig
52- Timeout time.Duration // Dial timeout
53- ReadTimeout time.Duration // I/O read timeout
54- WriteTimeout time.Duration // I/O write timeout
55- Logger Logger // Logger
38+ User string // Username
39+ Passwd string // Password (requires User)
40+ Net string // Network (e.g. "tcp", "tcp6", "unix". default: "tcp")
41+ Addr string // Address (default: "127.0.0.1:3306" for "tcp" and "/tmp/mysql.sock" for "unix")
42+ DBName string // Database name
43+ Params map [string ]string // Connection parameters
44+ ConnectionAttributes string // Connection Attributes, comma-delimited string of user-defined "key:value" pairs
45+ Collation string // Connection collation
46+ Loc * time.Location // Location for time.Time values
47+ MaxAllowedPacket int // Max packet size allowed
48+ ServerPubKey string // Server public key name
49+ pubKey * rsa.PublicKey // Server public key
50+ TLSConfig string // TLS configuration name
51+ TLS * tls.Config // TLS configuration, its priority is higher than TLSConfig
52+ Timeout time.Duration // Dial timeout
53+ ReadTimeout time.Duration // I/O read timeout
54+ WriteTimeout time.Duration // I/O write timeout
55+ Logger Logger // Logger
56+ BeforeConnect func (context.Context , * Config ) error // Invoked before a connection is established
5657
5758 AllowAllFiles bool // Allow all files to be used with LOAD DATA LOCAL INFILE
5859 AllowCleartextPasswords bool // Allows the cleartext client side plugin
@@ -66,8 +67,6 @@ type Config struct {
6667 MultiStatements bool // Allow multiple statements in one query
6768 ParseTime bool // Parse time values to time.Time
6869 RejectReadOnly bool // Reject read-only connections
69-
70- BeforeConnect func (context.Context , * Config ) error // Invoked before a connection is established
7170}
7271
7372// NewConfig creates a new Config and sets default values.
0 commit comments