sources

package
v1.57.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sources provides concrete enrichment Source adapters for the platform's built-in toolkits (Trino, DataHub). Each adapter is a thin shim that satisfies the enrichment.Source interface and delegates to a caller-supplied client function so the underlying SDK version stays a detail of platform startup, not of this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataHubGetEntityFunc

type DataHubGetEntityFunc func(ctx context.Context, urn string) (any, error)

DataHubGetEntityFunc resolves a DataHub entity by URN.

type DataHubGetGlossaryTermFunc

type DataHubGetGlossaryTermFunc func(ctx context.Context, urn string) (any, error)

DataHubGetGlossaryTermFunc resolves a DataHub glossary term by URN.

type DataHubSource

type DataHubSource struct {
	// contains filtered or unexported fields
}

DataHubSource exposes read-only DataHub lookups for enrichment rules. The underlying calls are passed in as functions so this package doesn't depend on a specific DataHub SDK version.

func NewDataHubSource

func NewDataHubSource(getEntity DataHubGetEntityFunc, getGlossaryTerm DataHubGetGlossaryTermFunc) *DataHubSource

NewDataHubSource builds a DataHub-backed source. Either function may be nil — the corresponding operation will report unsupported at execute time. This lets a deployment opt-in to a subset of operations without having to provide a stub for the rest.

func (*DataHubSource) Execute

func (s *DataHubSource) Execute(ctx context.Context, op string, params map[string]any) (any, error)

Execute dispatches the requested operation. Recognized parameters:

get_entity         { urn string }
get_glossary_term  { urn string }

func (*DataHubSource) Name

func (*DataHubSource) Name() string

Name returns the canonical source name "datahub".

func (*DataHubSource) Operations

func (*DataHubSource) Operations() []string

Operations returns the read-only operation allowlist.

type TrinoQueryFunc

type TrinoQueryFunc func(ctx context.Context, connection, sql string) ([]map[string]any, error)

TrinoQueryFunc executes a SQL query against a named Trino connection and returns the row set. Implementations are platform-side.

type TrinoSource

type TrinoSource struct {
	// contains filtered or unexported fields
}

TrinoSource exposes a single read-only "query" operation that runs a SQL template against a named Trino connection. The :name placeholders in the template are substituted with **escaped ANSI-SQL literals** derived from the binding values — single quotes are doubled, NULL is emitted for nil, ints/floats/bools are rendered as literals. This is not server-side parameter binding (the Trino Go client does not expose a parameterized exec path on our existing query interface); the escaping is sound for the supported value types but identifiers are not substitutable.

func NewTrinoSource

func NewTrinoSource(exec TrinoQueryFunc) *TrinoSource

NewTrinoSource builds a Source backed by the given query function.

func (*TrinoSource) Execute

func (s *TrinoSource) Execute(ctx context.Context, op string, params map[string]any) (any, error)

Execute runs the requested operation. Recognized parameters for "query":

connection    string  required — name of a configured Trino connection
sql_template  string  required — SQL with optional :name placeholders

Any additional parameters are treated as bindings and substituted into :<name> placeholders. Strings are single-quoted with embedded quotes doubled per ANSI SQL; numbers and bools are rendered as literals; nil becomes NULL. Other types are rejected.

func (*TrinoSource) Name

func (*TrinoSource) Name() string

Name returns the canonical source name "trino".

func (*TrinoSource) Operations

func (*TrinoSource) Operations() []string

Operations returns the read-only operation allowlist.

Jump to

Keyboard shortcuts

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