Documentation
¶
Overview ¶
Package connsource maps connections to their DataHub URN components (platform name and catalog mapping), with forward and reverse lookups. It is extracted from the platform facade so that package stays within its size budget; the platform re-exports Source and Map as type aliases for its existing callers.
Index ¶
- type Map
- func (m *Map) Add(src Source)
- func (m *Map) ConnectionsForSource(datahubSourceName string) []*Source
- func (m *Map) ConnectionsForURN(urn string) []*Source
- func (m *Map) DataHubSourceName(kind, name string) string
- func (m *Map) ForConnection(kind, name string) *Source
- func (m *Map) ForConnectionName(name string) *Source
- func (m *Map) Remove(kind, name string)
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map provides forward and reverse lookups between connections and DataHub URN components.
func (*Map) Add ¶
Add registers a connection's DataHub source mapping. If the same connection (kind+name) already exists, the old entry is replaced so that bySourceName never contains duplicates.
func (*Map) ConnectionsForSource ¶
ConnectionsForSource returns all connections that map to the given DataHub source name (e.g. "trino" returns all Trino connections).
func (*Map) ConnectionsForURN ¶
ConnectionsForURN parses a DataHub URN and returns all connections whose source name matches the URN's platform. Returns nil if the URN can't be parsed.
func (*Map) DataHubSourceName ¶
DataHubSourceName returns the DataHub source name mapped to a connection, or "" when none; it adapts the map to the connview.SourceResolver capability.
func (*Map) ForConnection ¶
ForConnection returns the DataHub source info for a connection. Returns nil if the connection has no mapping.
func (*Map) ForConnectionName ¶
ForConnectionName returns the DataHub source info by connection name only. Searches all kinds. Returns nil if not found.
type Source ¶
type Source struct {
// Kind is the toolkit kind (trino, s3).
Kind string `json:"kind"`
// Name is the connection name.
Name string `json:"name"`
// DataHubSourceName is the platform identifier in DataHub URNs
// (e.g. "trino", "postgres", "s3"). Multiple connections can share the same
// source name.
DataHubSourceName string `json:"datahub_source_name"`
// CatalogMapping maps connection catalog names to DataHub catalog names.
// For example: {"rdbms": "postgres"} means the connection's "rdbms" catalog
// corresponds to "postgres" in DataHub URNs.
CatalogMapping map[string]string `json:"catalog_mapping,omitempty"`
// Description is the human-readable connection description.
Description string `json:"description,omitempty"`
}
Source holds the DataHub mapping for a single connection.