-
Notifications
You must be signed in to change notification settings - Fork 248
/
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)
}
}