helpers

package
v1.74.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatasetVersionURL added in v1.56.0

func DatasetVersionURL(datasetID, edition, version string) string

DatasetVersionURL constructs a dataset version URL from the provided datasetID, edition and version values

func ExtractDatasetInfoFromPath

func ExtractDatasetInfoFromPath(path string) (datasetID, edition, version string, err error)

ExtractDatasetInfoFromPath gets the datasetID, edition and version from a given path

func GenerateSharingLink(socialType, currentURL, title string) string

GenerateSharingLink returns a sharing link for different types of social media

func GetAPIRouterVersion added in v1.18.0

func GetAPIRouterVersion(rawurl string) (string, error)

GetAPIRouterVersion returns the path of the provided url, which corresponds to the api router version

func GetContactDetails added in v1.70.0

func GetContactDetails(d dpDatasetApiModels.Dataset) (contact.Details, bool)

Collects the contact details of a datset into a contacts object and provides a HasContactDetails flag.

func GetCurrentURL added in v1.56.0

func GetCurrentURL(lang, siteDomain, urlPath string) string

GetCurrentURL returns a string of the current URL from language, site domain and url path parameters

func GetDistributionFileURL added in v1.69.0

func GetDistributionFileURL(distributionList *[]dpDatasetApiModels.Distribution, requestedFormat string) string

Loops through the input list of distributions to find a distribution with a format that matches the requested format. If a matching distribution is found, the download URL of that distribution is returned. If no matching distribution is found, it returns an empty string.

func GetDownloadFileURL added in v1.69.0

func GetDownloadFileURL(downloadList *dpDatasetApiModels.DownloadList, requestedFormat string) string

Loops through a list of download objects to find a download with a format that matches the requested format. If a matching download object is found, it returns the HRef (URL) of that download object. If no matching download object is found, it returns an empty string.

func GetLatestVersionID added in v1.71.0

func GetLatestVersionID(versionsList dpDatasetApiSdk.VersionsList) int

func GetOSRLogoDetails added in v1.63.0

func GetOSRLogoDetails(language string) osrlogo.OSRLogo

GetOSRLogoDetails returns the official statistics logo details based on the language

func HasStringInSlice added in v1.39.0

func HasStringInSlice(a string, list []string) bool

HasStringInSlice checks for a string within in a string array

func IsBoolPtr added in v1.34.0

func IsBoolPtr(val *bool) bool

IsBoolPtr determines if the given value is a pointer

func MapDownloadObjectExtensions added in v1.69.0

func MapDownloadObjectExtensions(downloadList *dpDatasetApiModels.DownloadList) map[*dpDatasetApiModels.DownloadObject]string

Creates a mapping from download objects to their corresponding file extension strings

func MapVersionDownloads added in v1.69.0

func MapVersionDownloads(sharedModelVersion *sharedModel.Version, downloadList *dpDatasetApiModels.DownloadList)

Maps download objects from a dp-dataset-api Version to download details, including file extensions, sizes, and URIs

func PersistExistingParams added in v1.39.0

func PersistExistingParams(values []string, key, ignoreValue string, q url.Values)

PersistExistingParams persists existing query string values and ignores a given value

func ToBoolPtr added in v1.39.0

func ToBoolPtr(val bool) *bool

ToBoolPtr converts a boolean to a pointer

Types

This section is empty.

Jump to

Keyboard shortcuts

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