ConnectionString returns a gorm compatible connection string
()
| 632 | |
| 633 | // ConnectionString returns a gorm compatible connection string |
| 634 | func (m *MySQL) ConnectionString() (string, error) { |
| 635 | if err := m.Validate(); err != nil { |
| 636 | return "", err |
| 637 | } |
| 638 | |
| 639 | connString := fmt.Sprintf( |
| 640 | "%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local&timeout=5s", |
| 641 | m.Username, m.Password, |
| 642 | m.Hostname, m.DatabaseName, |
| 643 | ) |
| 644 | return connString, nil |
| 645 | } |
| 646 | |
| 647 | // TLSConfig is the API server TLS config |
| 648 | type TLSConfig struct { |