blob: 3058769d607fdf629be4626fa27b0cd7b782e8eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package app
import (
"github.com/mattermost/mattermost-server/store"
)
type Option func(a *App)
// By default, the app will use the store specified by the configuration. This allows you to
// construct an app with a different store.
//
// The storeOrFactory parameter must be either a store.Store or func() store.Store.
func StoreOverride(storeOrFactory interface{}) Option {
return func(a *App) {
switch s := storeOrFactory.(type) {
case store.Store:
a.newStore = func() store.Store {
return s
}
case func() store.Store:
a.newStore = s
default:
panic("invalid StoreOverride")
}
}
}
|