@@ -34,22 +34,23 @@ 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
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
+ ConnectionAttributes string // Connection Attributes, comma-delimited string of user-defined "key:value" pairs
53
54
54
55
AllowAllFiles bool // Allow all files to be used with LOAD DATA LOCAL INFILE
55
56
AllowCleartextPasswords bool // Allows the cleartext client side plugin
@@ -554,6 +555,11 @@ func parseDSNParams(cfg *Config, params string) (err error) {
554
555
if err != nil {
555
556
return
556
557
}
558
+
559
+ // Connection attributes
560
+ case "connectionAttributes" :
561
+ cfg .ConnectionAttributes = value
562
+
557
563
default :
558
564
// lazy init
559
565
if cfg .Params == nil {
0 commit comments