-
Notifications
You must be signed in to change notification settings - Fork 117
/
connectors.go
61 lines (54 loc) · 1.44 KB
/
connectors.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package drivers
import (
"fmt"
)
// Connectors tracks all registered connector drivers.
var Connectors = make(map[string]Driver)
// RegisterAsConnector tracks a connector driver.
func RegisterAsConnector(name string, driver Driver) {
if Connectors[name] != nil {
panic(fmt.Errorf("already registered connector with name '%s'", name))
}
Connectors[name] = driver
}
// Spec provides metadata about a connector and the properties it supports.
type Spec struct {
DisplayName string
Description string
DocsURL string
ConfigProperties []*PropertySpec
SourceProperties []*PropertySpec
ImplementsRegistry bool
ImplementsCatalog bool
ImplementsRepo bool
ImplementsAdmin bool
ImplementsAI bool
ImplementsSQLStore bool
ImplementsOLAP bool
ImplementsObjectStore bool
ImplementsFileStore bool
ImplementsNotifier bool
}
// PropertySpec provides metadata about a single connector property.
type PropertySpec struct {
Key string
Type PropertyType
Required bool
DisplayName string
Description string
DocsURL string
Hint string
Default string
Placeholder string
Secret bool
}
// PropertyType is an enum of types supported for connector properties.
type PropertyType int
const (
UnspecifiedPropertyType PropertyType = iota
NumberPropertyType
BooleanPropertyType
StringPropertyType
FilePropertyType
InformationalPropertyType
)