1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-27 13:48:52 +02:00
focalboard/server/services/store/sqlstore/params.go
2022-07-15 08:04:35 +02:00

39 lines
775 B
Go

package sqlstore
import (
"database/sql"
"fmt"
"github.com/mattermost/mattermost-server/v6/plugin"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type Params struct {
DBType string
ConnectionString string
TablePrefix string
Logger *mlog.Logger
DB *sql.DB
IsPlugin bool
IsSingleUser bool
NewMutexFn MutexFactory
PluginAPI *plugin.API
}
func (p Params) CheckValid() error {
if p.IsPlugin && p.NewMutexFn == nil {
return ErrStoreParam{name: "NewMutexFn", issue: "cannot be nil in plugin mode"}
}
return nil
}
type ErrStoreParam struct {
name string
issue string
}
func (e ErrStoreParam) Error() string {
return fmt.Sprintf("invalid store params: %s %s", e.name, e.issue)
}