@@ -34,23 +34,24 @@ var (
34
34
// If a new Config is created instead of being parsed from a DSN string,
35
35
// the NewConfig function should be used, which sets default values.
36
36
type Config struct {
37
- User string // Username
38
- Passwd string // Password (requires User)
39
- Net string // Network type
40
- Addr string // Network address (requires Net)
41
- DBName string // Database name
42
- Params map [string ]string // Connection parameters
43
- Collation string // Connection collation
44
- Loc * time.Location // Location for time.Time values
45
- MaxAllowedPacket int // Max packet size allowed
46
- ServerPubKey string // Server public key name
47
- pubKey * rsa.PublicKey // Server public key
48
- TLSConfig string // TLS configuration name
49
- TLS * tls.Config // TLS configuration, its priority is higher than TLSConfig
50
- Timeout time.Duration // Dial timeout
51
- ReadTimeout time.Duration // I/O read timeout
52
- WriteTimeout time.Duration // I/O write timeout
53
- Logger Logger // Logger
37
+ User string // Username
38
+ Passwd string // Password (requires User)
39
+ Net string // Network type
40
+ Addr string // Network address (requires Net)
41
+ DBName string // Database name
42
+ Params map [string ]string // Connection parameters
43
+ ConnectionAttributes string // Connection Attributes, comma-delimited string of user-defined "key:value" pairs
44
+ Collation string // Connection collation
45
+ Loc * time.Location // Location for time.Time values
46
+ MaxAllowedPacket int // Max packet size allowed
47
+ ServerPubKey string // Server public key name
48
+ pubKey * rsa.PublicKey // Server public key
49
+ TLSConfig string // TLS configuration name
50
+ TLS * tls.Config // TLS configuration, its priority is higher than TLSConfig
51
+ Timeout time.Duration // Dial timeout
52
+ ReadTimeout time.Duration // I/O read timeout
53
+ WriteTimeout time.Duration // I/O write timeout
54
+ Logger Logger // Logger
54
55
55
56
AllowAllFiles bool // Allow all files to be used with LOAD DATA LOCAL INFILE
56
57
AllowCleartextPasswords bool // Allows the cleartext client side plugin
@@ -560,6 +561,11 @@ func parseDSNParams(cfg *Config, params string) (err error) {
560
561
if err != nil {
561
562
return
562
563
}
564
+
565
+ // Connection attributes
566
+ case "connectionAttributes" :
567
+ cfg .ConnectionAttributes = value
568
+
563
569
default :
564
570
// lazy init
565
571
if cfg .Params == nil {
0 commit comments