Help us shape the future of Go! Take the 2026 Go Developer Survey

catalogsemantic

package
v1.149.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package catalogsemantic is the platform's semantic.Provider over its own catalog (#1919): table and column context, glossary terms, dataset search, curated query counts and lineage, all read from the catalog store. It is the only provider on a deployment with a database; the consumers of semantic.Provider are unchanged.

A dataset belongs to the connection that sees it, and a semantic.TableIdentifier names no connection. The provider takes the connection from the call being enriched when there is one, and otherwise reads the first connection that catalogs a table at that path. A dataset is named by its mcp:dataset reference; any other form is not found.

Index

Constants

View Source
const Name = "catalog"

Name is the provider's name.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefinitionLister

type DefinitionLister interface {
	ListDefinitions(ctx context.Context, q catalog.DefinitionQuery) ([]catalog.DefinitionSummary, error)
}

DefinitionLister lists the catalog's definitions; the catalog store implements it. A store without it picks nothing.

type InstanceOf

type InstanceOf func(bound string) (string, bool)

InstanceOf returns the instance name of the Trino connection a call bound by name, and false when no live connection has that name.

type Option added in v1.147.0

type Option func(*Provider)

Option configures a Provider.

func WithInheritance added in v1.147.0

func WithInheritance(reach Reach) Option

WithInheritance turns lineage inheritance on. A nil reach lends from every upstream dataset.

type Provider

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

Provider is the native semantic provider. The curation it returns is written by people and by agents, and reaches a model in tool results, so every context read passes through the semantic sanitizer first.

func New

func New(store Reader, instance InstanceOf, opts ...Option) *Provider

New builds the provider. A nil instance lookup uses the bound name as the instance.

func (*Provider) Close

func (*Provider) Close() error

Close releases nothing; the store's pool belongs to the platform.

func (*Provider) GetColumnContext

func (p *Provider) GetColumnContext(ctx context.Context, column semantic.ColumnIdentifier) (*semantic.ColumnContext, error)

GetColumnContext returns one column's curation.

func (*Provider) GetColumnsContext

func (p *Provider) GetColumnsContext(ctx context.Context, table semantic.TableIdentifier) (map[string]*semantic.ColumnContext, error)

GetColumnsContext returns every column's curation, by column name. With lineage inheritance on, a column lacking a description or glossary terms shows what the nearest upstream column of its name has (inherit.go).

func (*Provider) GetCuratedQueryCount

func (p *Provider) GetCuratedQueryCount(ctx context.Context, urn string) (int, error)

GetCuratedQueryCount counts a dataset's curated queries. A dataset the catalog does not hold has none.

func (*Provider) GetGlossaryTerm

func (p *Provider) GetGlossaryTerm(ctx context.Context, urn string) (*semantic.GlossaryTerm, error)

GetGlossaryTerm reads a glossary term by its reference.

func (*Provider) GetLineage

func (p *Provider) GetLineage(
	ctx context.Context, table semantic.TableIdentifier, direction semantic.LineageDirection, maxDepth int,
) (*semantic.LineageInfo, error)

GetLineage walks a table's lineage edges.

func (*Provider) GetTableContext

func (p *Provider) GetTableContext(ctx context.Context, table semantic.TableIdentifier) (*semantic.TableContext, error)

GetTableContext returns a table's curation.

func (*Provider) ListDomains

func (p *Provider) ListDomains(ctx context.Context) ([]semantic.EntityRef, error)

ListDomains returns every domain.

func (*Provider) Name

func (*Provider) Name() string

Name returns "catalog".

func (*Provider) SearchDataProducts

func (p *Provider) SearchDataProducts(ctx context.Context, query string, limit int) ([]semantic.EntityRef, error)

SearchDataProducts finds data products the same way.

func (*Provider) SearchGlossaryTerms

func (p *Provider) SearchGlossaryTerms(ctx context.Context, query string, limit int) ([]semantic.EntityRef, error)

SearchGlossaryTerms finds glossary terms whose name, slug or description holds the query; an empty query lists them.

func (*Provider) SearchGlossaryTermsCounted

func (p *Provider) SearchGlossaryTermsCounted(ctx context.Context, query string, limit int) ([]semantic.EntityRef, int, error)

SearchGlossaryTermsCounted runs SearchGlossaryTerms and reports the total the same way.

func (*Provider) SearchTables

func (p *Provider) SearchTables(ctx context.Context, filter semantic.SearchFilter) ([]semantic.TableSearchResult, error)

SearchTables finds datasets. Query "*" lists them.

func (*Provider) SearchTablesCounted

func (p *Provider) SearchTablesCounted(ctx context.Context, filter semantic.SearchFilter) ([]semantic.TableSearchResult, int, error)

SearchTablesCounted runs SearchTables and reports the total: a page shorter than the limit asked for is every match, because the catalog returns exactly the page it is asked for; a full page leaves the total unknown.

type Reach added in v1.147.0

type Reach func(ctx context.Context, reference string) bool

Reach reports whether the call in ctx may see a dataset reference. An upstream dataset it does not reach lends nothing.

type Reader

type Reader interface {
	GetDataset(ctx context.Context, ref catalog.Ref) (*catalog.Dataset, error)
	GetDefinition(ctx context.Context, ref catalog.Ref) (*catalog.Definition, error)
	DatasetsByPath(ctx context.Context, connectionKind, path string) ([]string, error)
	SearchDatasets(ctx context.Context, q catalog.DatasetQuery) ([]catalog.DatasetSummary, error)
	Lineage(ctx context.Context, ref string, direction catalog.Direction, maxDepth int) ([]catalog.Hop, error)
}

Reader is what the provider reads from the catalog store.

Jump to

Keyboard shortcuts

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