simplify code

This commit is contained in:
Yuan Liu 2018-10-18 01:45:14 +08:00 committed by GitHub
parent 36dbc5f51c
commit f640df7a2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,11 +21,9 @@ func init() {
func newMysqlQueryEndpoint(datasource *models.DataSource) (tsdb.TsdbQueryEndpoint, error) {
logger := log.New("tsdb.mysql")
var protocol string
protocol := "tcp"
if strings.HasPrefix(datasource.Url, "/") {
protocol = "unix"
} else {
protocol = "tcp"
}
cnnstr := fmt.Sprintf("%s:%s@%s(%s)/%s?collation=utf8mb4_unicode_ci&parseTime=true&loc=UTC&allowNativePasswords=true",
datasource.User,