connsource

package
v1.102.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

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

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 NewMap

func NewMap() *Map

NewMap creates an empty source map.

func (*Map) Add

func (m *Map) Add(src Source)

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

func (m *Map) ConnectionsForSource(datahubSourceName string) []*Source

ConnectionsForSource returns all connections that map to the given DataHub source name (e.g. "trino" returns all Trino connections).

func (*Map) ConnectionsForURN

func (m *Map) ConnectionsForURN(urn string) []*Source

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

func (m *Map) DataHubSourceName(kind, name string) string

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

func (m *Map) ForConnection(kind, name string) *Source

ForConnection returns the DataHub source info for a connection. Returns nil if the connection has no mapping.

func (*Map) ForConnectionName

func (m *Map) ForConnectionName(name string) *Source

ForConnectionName returns the DataHub source info by connection name only. Searches all kinds. Returns nil if not found.

func (*Map) Remove

func (m *Map) Remove(kind, name string)

Remove deletes a connection's DataHub source mapping.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL