models

package
v0.0.0-...-08024dd Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code struct {
	ID    string     `json:"code"`
	Label string     `json:"label"`
	Links *CodeLinks `json:"links"`
}

Code for a single dimensions type

func NewCode

func NewCode(dbCode *dbmodels.Code) *Code

NewCode creates a new Code struct from a Code DB model

func (c *Code) UpdateLinks(host, codeListID, edition string) error

UpdateLinks updates the links for a code list

type CodeLinks struct {
	CodeList *Link `json:"code_list"`
	Datasets *Link `json:"datasets"`
	Self     *Link `json:"self"`
}

CodeLinks contains links for a code resource

type CodeList

type CodeList struct {
	ID    string        `json:"-"`
	Links *CodeListLink `json:"links,omitempty"`
}

CodeList containing links to all possible codes

func NewCodeList

func NewCodeList(dbCodeList *dbmodels.CodeList) *CodeList

NewCodeList creates a new CodeList struct from a CodeList DB model

func (c *CodeList) UpdateLinks(url string) error

UpdateLinks updates the links from

type CodeListLink struct {
	Self     *Link `json:"self,omitempty"`
	Editions *Link `json:"editions,omitempty"`
}

CodeListLink contains links for a code list resource

type CodeListResults

type CodeListResults struct {
	Items      []CodeList `json:"items"`
	Count      int        `json:"count"`
	Offset     int        `json:"offset"`
	Limit      int        `json:"limit"`
	TotalCount int        `json:"total_count"`
}

CodeListResults contains an array of code lists which can be paginated

func NewCodeListResults

func NewCodeListResults(dbCodeLists []dbmodels.CodeList) *CodeListResults

NewCodeListResults creates a new CodeListResult struct from a CodeListResult DB model.

type CodeResults

type CodeResults struct {
	Items      []Code `json:"items"`
	Count      int    `json:"count"`
	Offset     int    `json:"offset"`
	Limit      int    `json:"limit"`
	TotalCount int    `json:"total_count"`
}

CodeResults contains an array of codes which can be paginated

func NewCodeResults

func NewCodeResults(dbCodes []dbmodels.Code) *CodeResults

NewCodeResults creates a new CodeResult struct from a CodeResult DB model.

type Dataset

type Dataset struct {
	ID             string
	Links          *DatasetLinks    `json:"links"`
	DimensionLabel string           `json:"dimension_label"`
	Editions       []DatasetEdition `json:"editions"`
}

Dataset represents an individual model dataset

func NewDataset

func NewDataset(dbDataset *dbmodels.Dataset) *Dataset

NewDataset creates a new Dataset struct from a database Dataset struct

func (d *Dataset) UpdateLinks(datasetAPIhost, codeListID string) error

UpdateLinks updates the Dataset Self Link, and all the nested DatasetEdition links.

type DatasetEdition

type DatasetEdition struct {
	ID            string
	LatestVersion int
	Links         *DatasetEditionLinks `json:"links"`
}

func NewDatasetEdition

func NewDatasetEdition(dbDatasetEdition *dbmodels.DatasetEdition) *DatasetEdition

NewDatasetEdition creates a new DatasetEdition struct from a database DatasetEdition

func (e *DatasetEdition) UpdateLinks(datasetAPIhost, codeListID, datasetID string) error

UpdateLinks updates the links for the DatasetEdition

type DatasetEditionLinks struct {
	Self             *Link `json:"self"`
	DatasetDimension *Link `json:"dataset_dimension"`
	LatestVersion    *Link `json:"latest_version"`
}
type DatasetLinks struct {
	Self *Link `json:"self"`
}

DatasetLinks represents the links returned specifically for a dataset

type Datasets

type Datasets struct {
	Items      []Dataset `json:"items"`
	Count      int       `json:"count"`
	Offset     int       `json:"offset"`
	Limit      int       `json:"limit"`
	TotalCount int       `json:"total_count"`
}

Datasets represents the model returned from the api datasets endpoint

func NewDatasets

func NewDatasets(dbData []dbmodels.Dataset) *Datasets

NewDatasets creates a new Datasets struct from a database Datasets

func (ds *Datasets) UpdateLinks(datasetAPIhost, codeListID string) error

UpdateLinks updates the Dataset Links for all datasets in items.

type Edition

type Edition struct {
	ID    string        `json:"edition"`
	Label string        `json:"label"`
	Links *EditionLinks `json:"links"`
}

Edition represents a single edition response model

func NewEdition

func NewEdition(dbEdition *dbmodels.Edition) *Edition

NewEdition creates an Edition struct from a DB Edition model

func (e *Edition) UpdateLinks(codeListID, url string) error

UpdateLinks updates the EditionLinks in the Edition struct with the provided codeListID

type EditionLinks struct {
	Self     *Link `json:"self"`
	Editions *Link `json:"editions"`
	Codes    *Link `json:"codes"`
}

EditionLinks represents the links returned for a specific edition

type Editions

type Editions struct {
	Items      []Edition `json:"items"`
	Count      int       `json:"count"`
	Offset     int       `json:"offset"`
	Limit      int       `json:"limit"`
	TotalCount int       `json:"total_count"`
}

Editions represents the editions response model

func NewEditions

func NewEditions(dbEdition []dbmodels.Edition) *Editions

NewEditions creates an Editions struct from a DB Editions model

type Link struct {
	ID   string `json:"id,omitempty"     bson:"id"`
	Href string `json:"href"             bson:"href"`
}

Link contains the id and a link to a resource

func CreateLink(id, href, host string) *Link

Jump to

Keyboard shortcuts

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