MM-11262: database config store (#10281)
* vendor github.com/jmoiron/sqlx * MM-11262: introduce a database store * revert unnecessary fmt.Errorf * simplify unit test helper methods * remote TODO re: retry * relocate initializeConfigurationsTable for clarity * factor out a commonStore * acquire database config lock on close for safety * add missing header * fix lock comment
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
898a3a289c
Коммит
9bf5687311
@@ -4,6 +4,8 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
)
|
||||
|
||||
@@ -39,3 +41,12 @@ type Store interface {
|
||||
// Close cleans up resources associated with the store.
|
||||
Close() error
|
||||
}
|
||||
|
||||
// NewStore creates a database or file store given a data source name by which to connect.
|
||||
func NewStore(dsn string, watch bool) (Store, error) {
|
||||
if strings.HasPrefix(dsn, "mysql://") || strings.HasPrefix(dsn, "postgres://") {
|
||||
return NewDatabaseStore(dsn)
|
||||
}
|
||||
|
||||
return NewFileStore(dsn, watch)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user