-
Notifications
You must be signed in to change notification settings - Fork 247
/
storage.go
38 lines (35 loc) · 981 Bytes
/
storage.go
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
30
31
32
33
34
35
36
37
38
package checkup
import (
"encoding/json"
"fmt"
"github.com/sourcegraph/checkup/storage/appinsights"
"github.com/sourcegraph/checkup/storage/fs"
"github.com/sourcegraph/checkup/storage/github"
"github.com/sourcegraph/checkup/storage/mysql"
"github.com/sourcegraph/checkup/storage/postgres"
"github.com/sourcegraph/checkup/storage/s3"
"github.com/sourcegraph/checkup/storage/sql"
"github.com/sourcegraph/checkup/storage/sqlite3"
)
func storageDecode(typeName string, config json.RawMessage) (Storage, error) {
switch typeName {
case sqlite3.Type:
return sqlite3.New(config)
case mysql.Type:
return mysql.New(config)
case postgres.Type:
return postgres.New(config)
case s3.Type:
return s3.New(config)
case github.Type:
return github.New(config)
case fs.Type:
return fs.New(config)
case sql.Type:
return sql.New(config)
case appinsights.Type:
return appinsights.New(config)
default:
return nil, fmt.Errorf(errUnknownStorageType, typeName)
}
}