exportadapters

package
v1.101.0 Latest Latest
Warning

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

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

Documentation

Overview

Package exportadapters adapts the platform's portal stores to the export interfaces consumed by the trino and api-gateway toolkits.

The trino_export and api_export tools each declare a minimal interface subset of the portal store they need (to avoid a portal→registry→toolkit import cycle). An Exporter bridges concrete portal.AssetStore / portal.VersionStore / portal.ShareStore to those toolkit-side interfaces, translating between the toolkit's export DTOs and the portal row types.

One exporter per toolkit implements all three interfaces (asset store, version store, share creator), so wiring is a single construction whose result is assigned to each ExportDeps field. Each exporter takes its dependencies as constructor parameters (issue #756).

TrinoExporter and APIExporter are near-identical: the two toolkits define field-identical-but-distinct ExportAsset/ExportVersion DTOs in separate packages (to avoid the import cycle), and Go cannot map fields across unrelated struct types generically. The mapping is therefore written once per toolkit; token generation, the default notice, and the public-share flow are shared via portal primitives and createPublicShare.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIExporter

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

APIExporter adapts the portal stores to the api-gateway toolkit's export interfaces. It mirrors TrinoExporter; the divergence is the field-identical- but-distinct apigatewaykit.Export* DTO types, which Go cannot map across generically (see the package doc).

func NewAPIExporter

func NewAPIExporter(assets portal.AssetStore, versions portal.VersionStore, shares portal.ShareStore, baseURL string) *APIExporter

NewAPIExporter builds an APIExporter over the given portal stores. An empty baseURL disables share-URL computation (the share row is still inserted).

func (*APIExporter) CreateExportVersion

func (e *APIExporter) CreateExportVersion(ctx context.Context, ver apigatewaykit.ExportVersion) (int, error)

func (*APIExporter) CreatePublicShare

func (e *APIExporter) CreatePublicShare(ctx context.Context, assetID, createdBy string) (string, error)

func (*APIExporter) GetByIdempotencyKey

func (e *APIExporter) GetByIdempotencyKey(ctx context.Context, ownerID, key string) (*apigatewaykit.ExportAssetRef, error)

func (*APIExporter) InsertExportAsset

func (e *APIExporter) InsertExportAsset(ctx context.Context, asset apigatewaykit.ExportAsset) error

type TrinoExporter

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

TrinoExporter adapts the portal stores to the trino toolkit's export interfaces (ExportAssetStore, ExportVersionStore, ExportShareCreator).

func NewTrinoExporter

func NewTrinoExporter(assets portal.AssetStore, versions portal.VersionStore, shares portal.ShareStore, baseURL string) *TrinoExporter

NewTrinoExporter builds a TrinoExporter over the given portal stores. An empty baseURL disables share-URL computation (the share row is still inserted).

func (*TrinoExporter) CreateExportVersion

func (e *TrinoExporter) CreateExportVersion(ctx context.Context, ver trinokit.ExportVersion) (int, error)

func (*TrinoExporter) CreatePublicShare

func (e *TrinoExporter) CreatePublicShare(ctx context.Context, assetID, createdBy string) (string, error)

func (*TrinoExporter) GetByIdempotencyKey

func (e *TrinoExporter) GetByIdempotencyKey(ctx context.Context, ownerID, key string) (*trinokit.ExportAssetRef, error)

func (*TrinoExporter) InsertExportAsset

func (e *TrinoExporter) InsertExportAsset(ctx context.Context, asset trinokit.ExportAsset) error

Jump to

Keyboard shortcuts

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