mapper

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExtensionCSDB is the file extension for CSDB files.
	ExtensionCSDB = ".csdb"
	// ExtensionCSV is the file extension for CSV files.
	ExtensionCSV = ".csv"
	// ExtensionCSVW is the file extension for CSVW files.
	ExtensionCSVW = ".csvw"
	// ExtensionSDMX is the file extension for SDMX files.
	ExtensionSDMX = ".sdmx"
	// ExtensionXLS is the file extension for Microsoft Excel XLS files.
	ExtensionXLS = ".xls"
	// ExtensionXLSX is the file extension for Microsoft Excel XLSX files.
	ExtensionXLSX = ".xlsx"
	// MimeTypeCSDB is the MIME type for CSDB files.
	MimeTypeCSDB = "application/csdb"
	// MimeTypeCSV is the MIME type for CSV files.
	MimeTypeCSV = "text/csv"
	// MimeTypeCSVW is the MIME type for CSVW files.
	MimeTypeCSVW = "application/csvw+json"
	// MimeTypeSDMX is the MIME type for SDMX files.
	MimeTypeSDMX = "application/sdmx+xml"
	// MimeTypeXLS is the MIME type for Microsoft Excel XLS files.
	MimeTypeXLS = "application/vnd.ms-excel"
	// MimeTypeXLSX is the MIME type for Microsoft Excel XLSX files.
	MimeTypeXLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
	// MimeTypeOctetStream is the generic MIME type for binary data.
	MimeTypeOctetStream = "application/octet-stream"
)

Variables

This section is empty.

Functions

func DeriveMimeTypeFromFilename added in v0.26.1

func DeriveMimeTypeFromFilename(filename string) string

DeriveMimeTypeFromFilename returns the MIME type for a given file name. If the type cannot be determined, it returns "application/octet-stream".

func MapDatasetLandingPageToDatasetAPI

func MapDatasetLandingPageToDatasetAPI(ctx context.Context, datasetID string, pageData zebedee.DatasetLandingPage, topicCache *cache.TopicCache) (*datasetModels.Dataset, error)

MapDatasetLandingPageToDatasetAPI maps a Zebedee dataset landing page to a Dataset API dataset model. It extracts topic IDs from the URI and merges them with any existing topics from the page data.

func MapDatasetVersionToDatasetAPI added in v0.24.0

func MapDatasetVersionToDatasetAPI(editionID string, pageData zebedee.Dataset, seriesData zebedee.DatasetLandingPage, editionData zebedee.Dataset) (*datasetModels.Version, error)

MapDatasetVersionToDatasetAPI maps a Zebedee dataset version to a Dataset API dataset model.

func MapMimeTypeToDistributionFormat added in v0.26.1

func MapMimeTypeToDistributionFormat(mimeType string) (datasetModels.DistributionFormat, error)

MapMimeTypeToDistributionFormat maps a MIME type string to a DistributionFormat as used by the dp-dataset-api. If the MIME type is unsupported, it returns an error.

func MapResourceToUploadServiceMetadata added in v0.28.0

func MapResourceToUploadServiceMetadata(uri string, fileSize zebedee.FileSize) (uploadAPI.Metadata, error)

MapResourceToUploadServiceMetadata maps a Zebedee resource URI and file size to an upload service Metadata struct. It derives the MIME type from the fileextension. If the MIME type is unsupported, it returns an error.

func MapUploadServiceMetadataToDistribution added in v0.28.0

func MapUploadServiceMetadataToDistribution(uploadMetadata uploadAPI.Metadata) (datasetModels.Distribution, error)

MapUploadServiceMetadataToDistribution maps upload service Metadata to a dp-dataset-api Distribution. It maps the MIME type to a DistributionFormat. If the MIME type is unsupported, it returns an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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