This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/database/dialect.go
2026-02-28 01:40:31 +00:00

32 lines
735 B
Go

package database
// Dialect identifies the active database backend.
type Dialect int
const (
DialectPostgres Dialect = iota
DialectSQLite
)
// CurrentDialect is set during Connect() and read by store constructors
// to select the appropriate SQL flavour.
var CurrentDialect Dialect
// String returns a human-readable label.
func (d Dialect) String() string {
switch d {
case DialectPostgres:
return "postgres"
case DialectSQLite:
return "sqlite"
default:
return "unknown"
}
}
// IsPostgres returns true when connected to PostgreSQL.
func IsPostgres() bool { return CurrentDialect == DialectPostgres }
// IsSQLite returns true when connected to SQLite.
func IsSQLite() bool { return CurrentDialect == DialectSQLite }