forked from pingcap/tidb
/
xconfig.go
45 lines (42 loc) · 1.41 KB
/
xconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package mysql
import (
"crypto/tls"
"time"
)
type xconfig struct {
user string
passwd string
net string
addr string
dbname string
params map[string]string
loc *time.Location
tls *tls.Config
timeout time.Duration
collation uint8
allowAllFiles bool
allowCleartextPasswords bool
columnsWithAlias bool
interpolateParams bool
useXProtocol bool // use X protocol rather than native protocol
useGetCapabilities bool // for X protocol, do we send a GetCapabilities message to query server capabilities? default: true
}
func NewXconfigFromConfig(cfg *config) *xconfig {
return &xconfig{
user: cfg.user,
passwd: cfg.passwd,
net: cfg.net,
addr: cfg.addr,
dbname: cfg.dbname,
params: cfg.params,
loc: cfg.loc,
tls: cfg.tls,
timeout: cfg.timeout,
collation: cfg.collation,
allowAllFiles: cfg.allowAllFiles,
allowCleartextPasswords: cfg.allowCleartextPasswords,
columnsWithAlias: cfg.columnsWithAlias,
interpolateParams: cfg.interpolateParams,
useXProtocol: true,
}
}