MCPcopy Create free account
hub / github.com/rilldata/rill / driverForConnector

Method driverForConnector

runtime/parser/parser.go:1044–1077  ·  view source on GitHub ↗

driverForConnector resolves a connector name to a connector driver. It should not be invoked until after rill.yaml has been parsed.

(name string)

Source from the content-addressed store, hash-verified

1042// driverForConnector resolves a connector name to a connector driver.
1043// It should not be invoked until after rill.yaml has been parsed.
1044func (p *Parser) driverForConnector(name string) (string, drivers.Driver, error) {
1045 // Search rill.yaml and Connector resources for the connector's driver
1046 var driver string
1047 if p.RillYAML != nil {
1048 for _, c := range p.RillYAML.Connectors {
1049 if c.Name == name {
1050 driver = c.Type
1051 break
1052 }
1053 }
1054 }
1055 for _, c := range p.Resources {
1056 if c.ConnectorSpec != nil && c.Name.Name == name {
1057 driver = c.ConnectorSpec.Driver
1058 break
1059 }
1060 }
1061
1062 // If we found a driver, return it
1063 if driver != "" {
1064 connector, ok := drivers.Connectors[driver]
1065 if !ok {
1066 return "", nil, fmt.Errorf("unknown connector type %q", driver)
1067 }
1068 return driver, connector, nil
1069 }
1070
1071 // If the name matches a known driver, we consider it an implicitly defined connector
1072 connector, ok := drivers.Connectors[name]
1073 if !ok {
1074 return "", nil, fmt.Errorf("unknown connector %q", name)
1075 }
1076 return name, connector, nil
1077}
1078
1079// defaultOLAPConnector resolves the project's default OLAP connector.
1080// It should not be invoked until after rill.yaml has been parsed.

Callers 3

inferSQLRefsMethod · 0.95
analyzeModelMethod · 0.80
trackConnectorMethod · 0.80

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected