(c *install.InstallConfig, values string, pg bool)
| 155 | } |
| 156 | |
| 157 | func buildSocketConnectionString(c *install.InstallConfig, values string, pg bool) string { |
| 158 | if pg { |
| 159 | // leave empty host and use host=/path/to/file in query |
| 160 | u := &url.URL{} |
| 161 | u.Scheme = "postgres" |
| 162 | qv := url.Values{} |
| 163 | qv.Set("host", c.GetDbSocketFile()) |
| 164 | u.RawQuery = qv.Encode() |
| 165 | u.Path = c.GetDbTCPName() |
| 166 | u.User = url.UserPassword(c.DbSocketUser, c.DbSocketPassword) |
| 167 | return u.String() + "&" + values |
| 168 | |
| 169 | } else { |
| 170 | conf := mysql.NewConfig() |
| 171 | conf.User = c.GetDbSocketUser() |
| 172 | conf.Passwd = c.GetDbSocketPassword() |
| 173 | conf.Net = "unix" |
| 174 | conf.Addr = c.GetDbSocketFile() |
| 175 | conf.DBName = c.GetDbSocketName() |
| 176 | conf.ParseTime = true |
| 177 | return "mysql://" + conf.FormatDSN() + "&" + values |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | func buildSqliteConnectionString(c *install.InstallConfig, values string) string { |
| 182 | return "sqlite://" + c.GetDbSocketFile() + "?" + values |
no test coverage detected
searching dependent graphs…