mapper

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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"
	// ExtensionZIP is the file extension for ZIP files.
	ExtensionZIP = ".zip"
	// 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"
	// MimeTypeZIP is the MIME type for ZIP files.
	MimeTypeZIP = "application/zip"
)

Variables

This section is empty.

Functions

func CreateDatasetLink(datasetTopicSlug string, dataset *datasetModels.Dataset) string

CreateDatasetLink creates a link to the dataset in the new location, which is added to the migration link field in the source dataset landing page.

func CreateDatasetVersionLink(datasetTopicSlug string, version *datasetModels.Version) string

CreateDatasetVersionLink creates a link to the dataset version in the new location, which is added to the migration link field in the source dataset landing page.

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, datasetID 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, datasetID, edition, version 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