MCPcopy
hub / github.com/crowdsecurity/crowdsec / ConnectionDialect

Method ConnectionDialect

pkg/csconfig/database.go:221–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219}
220
221func (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
238func (d *DatabaseCfg) isSocketConfig() bool {
239 return d.Host == "" && d.Port == 0 && d.DbPath != ""

Callers 1

NewClientFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected