-
Notifications
You must be signed in to change notification settings - Fork 19
/
data_source_external.go
66 lines (52 loc) · 1.56 KB
/
data_source_external.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
62
63
64
65
66
package types
import (
vegapb "code.vegaprotocol.io/vega/protos/vega"
)
type DataSourceDefinitionExternal struct {
SourceType dataSourceType
}
func (e *DataSourceDefinitionExternal) isDataSourceType() {}
func (e *DataSourceDefinitionExternal) oneOfProto() interface{} {
return e.IntoProto()
}
// /
// IntoProto tries to return the base proto object from DataSourceDefinitionExternal.
func (e *DataSourceDefinitionExternal) IntoProto() *vegapb.DataSourceDefinitionExternal {
ds := &vegapb.DataSourceDefinitionExternal{}
if e.SourceType != nil {
switch dsn := e.SourceType.oneOfProto().(type) {
case *vegapb.DataSourceDefinitionExternal_Oracle:
ds = &vegapb.DataSourceDefinitionExternal{
SourceType: dsn,
}
}
}
return ds
}
func (e *DataSourceDefinitionExternal) String() string {
if e.SourceType != nil {
return e.SourceType.String()
}
return ""
}
func (e *DataSourceDefinitionExternal) DeepClone() dataSourceType {
if e.SourceType != nil {
return e.SourceType.DeepClone()
}
return nil
}
// /
// DataSourceDefinitionExternalFromProto tries to build the DataSourceDefinitionExternal object
// from the given proto object..
func DataSourceDefinitionExternalFromProto(protoConfig *vegapb.DataSourceDefinitionExternal) *DataSourceDefinitionExternal {
ds := &DataSourceDefinitionExternal{
SourceType: &DataSourceDefinitionExternalOracle{},
}
if protoConfig != nil {
switch tp := protoConfig.SourceType.(type) {
case *vegapb.DataSourceDefinitionExternal_Oracle:
ds.SourceType = DataSourceDefinitionExternalOracleFromProto(tp)
}
}
return ds
}