mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Co-authored-by: Tommie Gannert <tommie@gannert.se> Co-authored-by: Dan Peleg <dan@globekeeper.com>
21 lines
523 B
Go
21 lines
523 B
Go
package storage
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/matrix-org/dendrite/pushserver/storage/sqlite3"
|
|
"github.com/matrix-org/dendrite/setup/config"
|
|
)
|
|
|
|
// NewDatabase opens a new database
|
|
func Open(dbProperties *config.DatabaseOptions) (Database, error) {
|
|
switch {
|
|
case dbProperties.ConnectionString.IsSQLite():
|
|
return sqlite3.Open(dbProperties)
|
|
case dbProperties.ConnectionString.IsPostgres():
|
|
return nil, fmt.Errorf("can't use Postgres implementation")
|
|
default:
|
|
return nil, fmt.Errorf("unexpected database type")
|
|
}
|
|
}
|