1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00
focalboard/server/services/store/sqlstore/params.go
Miguel de la Cruz 4b0fb92fba
Multi product architecture (#3381)
- provides support for compiling Boards directly into the Mattermost suite server
- a ServicesAPI interface replaces the PluginAPI to allow for implementations coming from pluginAPI and suite server.
- a new product package provides a place to register Boards as a suite product and handles life-cycle events
- a new boards package replaces much of the mattermost-plugin logic, allowing this to be shared between plugin and product
- Boards now uses module workspaces; run make setup-go-work
2022-07-18 13:21:57 -04:00

45 lines
1.0 KiB
Go

package sqlstore
import (
"database/sql"
"fmt"
mmModel "github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
// servicesAPI is the interface required my the Params to interact with the mattermost-server.
// You can use plugin-api or product-api adapter implementations.
type servicesAPI interface {
GetChannelByID(string) (*mmModel.Channel, error)
}
type Params struct {
DBType string
ConnectionString string
TablePrefix string
Logger mlog.LoggerIFace
DB *sql.DB
IsPlugin bool
IsSingleUser bool
NewMutexFn MutexFactory
ServicesAPI servicesAPI
}
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)
}