| 219 | } |
| 220 | |
| 221 | func (d *DatabaseCfg) ConnectionDialect() (string, string, error) { |
| 222 | switch d.Type { |
| 223 | case "sqlite": |
| 224 | return "sqlite3", dialect.SQLite, nil |
| 225 | case "mysql": |
| 226 | return "mysql", dialect.MySQL, nil |
| 227 | case "pgx", "postgresql", "postgres": |
| 228 | if d.Type != "pgx" { |
| 229 | log.Debugf("database type '%s' is deprecated, switching to 'pgx' instead", d.Type) |
| 230 | } |
| 231 | |
| 232 | return "pgx", dialect.Postgres, nil |
| 233 | } |
| 234 | |
| 235 | return "", "", fmt.Errorf("unknown database type '%s'", d.Type) |
| 236 | } |
| 237 | |
| 238 | func (d *DatabaseCfg) isSocketConfig() bool { |
| 239 | return d.Host == "" && d.Port == 0 && d.DbPath != "" |