Documentation
¶
Index ¶
- Variables
- func CountDimensionOptions(database, collection, key, value string) (int, error)
- func DropDatabases(databases []string) error
- func GetDimensionOption(database, collection, key, value string) (dimensionOption datasetAPIModel.DimensionOption, err error)
- func GetJob(database, collection, key, value string) (importAPIModel.Job, error)
- func NewDatastore(uri string) error
- func Setup(d ...*Doc) error
- func Teardown(d ...*Doc) error
- func TeardownAll(database, collection string) error
- type Alert
- type BuildHierarchyTask
- type BuildSearchIndexTask
- type CodeList
- type ContactDetails
- type Dataset
- type DatasetLinks
- type DatasetUpdate
- type Dimension
- type Doc
- type DownloadItem
- type DownloadList
- type DownloadObject
- type Downloads
- type Edition
- type EditionLinks
- type EditionUpdate
- type Event
- type Filter
- type GeneralDetails
- type IDLink
- type ImportObservationsTask
- type Instance
- type InstanceEvent
- type InstanceImportTasks
- type InstanceLinks
- type LatestChange
- type LinkMap
- type LinkObject
- type Publisher
- type TemporalFrequency
- type UsageNote
- type Version
- type VersionLinks
Constants ¶
This section is empty.
Variables ¶
var ( Published = true Unpublished = false )
Possible values for flagging whether a filter resource (output or blueprint) is a filter against a published or unpublished version
Functions ¶
func CountDimensionOptions ¶
CountDimensionOptions retrieves a count of the number of dimension options exist for an instance in mongo
func DropDatabases ¶
DropDatabases cleans out all data by removing the databases specified
func GetDimensionOption ¶
func GetDimensionOption(database, collection, key, value string) (dimensionOption datasetAPIModel.DimensionOption, err error)
GetDimensionOption retrieves a dimension option document from mongo
func GetJob ¶
func GetJob(database, collection, key, value string) (importAPIModel.Job, error)
GetJob retrieves a job document from mongo
func NewDatastore ¶
NewDatastore creates a new mgo.Session with a strong consistency and a write mode of "majority"
func TeardownAll ¶
TeardownAll removes all documents from collection
Types ¶
type Alert ¶
type Alert struct {
Date string `bson:"date,omitempty" json:"date,omitempty"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
Type string `bson:"type,omitempty" json:"type,omitempty"`
}
Alert represents an object containing information on an alert
type BuildHierarchyTask ¶
type BuildHierarchyTask struct {
State string `bson:"state,omitempty" json:"state,omitempty"`
DimensionName string `bson:"dimension_name,omitempty" json:"dimension_name,omitempty"`
CodeListID string `bson:"code_list_id,omitempty" json:"code_list_id,omitempty"`
}
BuildHierarchyTask represents a task of importing a single hierarchy.
type BuildSearchIndexTask ¶
type BuildSearchIndexTask struct {
State string `bson:"state,omitempty" json:"state,omitempty"`
DimensionName string `bson:"dimension_name,omitempty" json:"dimension_name,omitempty"`
}
BuildSearchIndexTask represents a task of importing a single hierarchy into search.
type CodeList ¶
type CodeList struct {
Description string `json:"description"`
HRef string `json:"href"`
ID string `json:"id"`
Label string `json:"label"`
Name string `json:"name"`
}
CodeList for a dimension within an instance
type ContactDetails ¶
type ContactDetails struct {
Email string `bson:"email,omitempty" json:"email,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
Telephone string `bson:"telephone,omitempty" json:"telephone,omitempty"`
}
ContactDetails represents an object containing information of the contact
type Dataset ¶
type Dataset struct {
CollectionID string `bson:"collection_id,omitempty" json:"collection_id,omitempty"`
Contacts []ContactDetails `bson:"contacts,omitempty" json:"contacts,omitempty"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
Keywords []string `bson:"keywords,omitempty" json:"keywords,omitempty"`
ID string `bson:"_id,omitempty" json:"id,omitempty"`
License string `bson:"license,omitempty" json:"license,omitempty"`
Links *DatasetLinks `bson:"links,omitempty" json:"links,omitempty"`
Methodologies []GeneralDetails `bson:"methodologies,omitempty" json:"methodologies,omitempty"`
NationalStatistic *bool `bson:"national_statistic,omitempty" json:"national_statistic,omitempty"`
NextRelease string `bson:"next_release,omitempty" json:"next_release,omitempty"`
Publications []GeneralDetails `bson:"publications,omitempty" json:"publications,omitempty"`
Publisher *Publisher `bson:"publisher,omitempty" json:"publisher,omitempty"`
QMI *GeneralDetails `bson:"qmi,omitempty" json:"qmi,omitempty"`
RelatedDatasets []GeneralDetails `bson:"related_datasets,omitempty" json:"related_datasets,omitempty"`
ReleaseFrequency string `bson:"release_frequency,omitempty" json:"release_frequency,omitempty"`
State string `bson:"state,omitempty" json:"state,omitempty"`
Theme string `bson:"theme,omitempty" json:"theme,omitempty"`
Title string `bson:"title,omitempty" json:"title,omitempty"`
UnitOfMeasure string `bson:"unit_of_measure,omitempty" json:"unit_of_measure,omitempty"`
URI string `bson:"uri,omitempty" json:"uri,omitempty"`
}
Dataset contains all the metadata which does not change across editions and versions of a dataset
type DatasetLinks ¶
type DatasetLinks struct {
AccessRights *LinkObject `bson:"access_rights,omitempty" json:"access_rights,omitempty"`
Editions *LinkObject `bson:"editions,omitempty" json:"editions,omitempty"`
LatestVersion *LinkObject `bson:"latest_version,omitempty" json:"latest_version,omitempty"`
Self *LinkObject `bson:"self,omitempty" json:"self,omitempty"`
}
DatasetLinks represents a list of specific links related to the dataset resource
type DatasetUpdate ¶
type DatasetUpdate struct {
ID string `bson:"_id,omitempty" json:"id,omitempty"`
Current *Dataset `bson:"current,omitempty" json:"current,omitempty"`
Next *Dataset `bson:"next,omitempty" json:"next,omitempty"`
}
DatasetUpdate represents an evolving dataset with the current dataset and the updated dataset
func GetDataset ¶
func GetDataset(database, collection, key, value string) (DatasetUpdate, error)
GetDataset retrieves a dataset document from mongo
type Dimension ¶
type Dimension struct {
URL string `bson:"dimension_url" json:"dimension_url"`
Name string `bson:"name" json:"name"`
Options []string `bson:"options" json:"options"`
}
Dimension represents an object containing a list of dimension values and the dimension name
type DownloadItem ¶
type DownloadItem struct {
HRef string `bson:"href,omitempty" json:"href,omitempty"`
Private string `bson:"private,omitempty" json:"private,omitempty"`
Public string `bson:"public,omitempty" json:"public,omitempty"`
Size string `bson:"size,omitempty" json:"size,omitempty"`
}
DownloadItem represents an object containing information for the download item
type DownloadList ¶
type DownloadList struct {
CSV *DownloadObject `bson:"csv,omitempty" json:"csv,omitempty"`
CSVW *DownloadObject `bson:"csvw,omitempty" json:"csvw,omitempty"`
XLS *DownloadObject `bson:"xls,omitempty" json:"xls,omitempty"`
}
DownloadList represents a list of objects of containing information on the downloadable files
type DownloadObject ¶
type DownloadObject struct {
URL string `bson:"href,omitempty" json:"href,omitempty"`
Size string `bson:"size,omitempty" json:"size,omitempty"`
Public string `bson:"public,omitempty" json:"public,omitempty"`
Private string `bson:"private,omitempty" json:"private,omitempty"`
}
DownloadObject represents information on the downloadable file
type Downloads ¶
type Downloads struct {
CSV *DownloadItem `bson:"csv,omitempty" json:"csv,omitempty"`
XLS *DownloadItem `bson:"xls,omitempty" json:"xls,omitempty"`
}
Downloads represents a list of file types possible to download
type Edition ¶
type Edition struct {
Edition string `bson:"edition,omitempty" json:"edition,omitempty"`
ID string `bson:"id,omitempty" json:"id,omitempty"`
Links *EditionLinks `bson:"links,omitempty" json:"links,omitempty"`
State string `bson:"state,omitempty" json:"state,omitempty"`
time.Time `bson:"last_updated,omitempty" json:"-"`
}
Edition represents information related to a single edition for a dataset
type EditionLinks ¶
type EditionLinks struct {
Dataset *LinkObject `bson:"dataset,omitempty" json:"dataset,omitempty"`
LatestVersion *LinkObject `bson:"latest_version,omitempty" json:"latest_version,omitempty"`
Self *LinkObject `bson:"self,omitempty" json:"self,omitempty"`
Versions *LinkObject `bson:"versions,omitempty" json:"versions,omitempty"`
}
EditionLinks represents a list of specific links related to the edition resource of a dataset
type EditionUpdate ¶
type EditionUpdate struct {
ID string `bson:"_id,omitempty" json:"id,omitempty"`
Current *Edition `bson:"current,omitempty" json:"current,omitempty"`
Next *Edition `bson:"next,omitempty" json:"next,omitempty"`
}
EditionUpdate represents an evolving edition containing both the next and current edition
func GetEdition ¶
func GetEdition(database, collection, key, value string) (EditionUpdate, error)
GetEdition retrieves an edition document from mongo
type Event ¶
type Event struct {
Type string `bson:"type,omitempty" json:"type"`
Time time.Time `bson:"time,omitempty" json:"time"`
}
Event structure
type Filter ¶
type Filter struct {
InstanceID string `bson:"instance_id" json:"instance_id"`
UniqueTimestamp bson.MongoTimestamp `bson:"unique_timestamp" json:"-"`
Dimensions []Dimension `bson:"dimensions,omitempty" json:"dimensions,omitempty"`
Downloads *Downloads `bson:"downloads,omitempty" json:"downloads,omitempty"`
Events []*Event `bson:"events,omitempty" json:"events,omitempty"`
FilterID string `bson:"filter_id" json:"filter_id,omitempty"`
State string `bson:"state,omitempty" json:"state,omitempty"`
Links LinkMap `bson:"links" json:"links,omitempty"`
Published *bool `bson:"published,omitempty" json:"published,omitempty"`
}
Filter represents a structure for a filter blueprint or output
type GeneralDetails ¶
type GeneralDetails struct {
Description string `bson:"description,omitempty" json:"description,omitempty"`
HRef string `bson:"href,omitempty" json:"href,omitempty"`
Title string `bson:"title,omitempty" json:"title,omitempty"`
}
GeneralDetails represents generic fields stored against an object (reused)
type IDLink ¶
type IDLink struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
HRef string `bson:"href,omitempty" json:"href,omitempty"`
}
IDLink holds the id and a link to the resource
type ImportObservationsTask ¶
type ImportObservationsTask struct {
State string `bson:"state,omitempty" json:"state,omitempty"`
InsertedObservations int64 `bson:"total_inserted_observations,omitempty" json:"total_inserted_observations"`
}
ImportObservationsTask represents the task of importing instance observation data into the database.
type Instance ¶
type Instance struct {
Alerts *[]Alert `bson:"alerts,omitempty" json:"alerts,omitempty"`
InstanceID string `bson:"id,omitempty" json:"id,omitempty"`
CollectionID string `bson:"collection_id,omitempty" json:"collection_id,omitempty"`
Dimensions []CodeList `bson:"dimensions,omitempty" json:"dimensions,omitempty"`
Downloads *DownloadList `bson:"downloads,omitempty" json:"downloads,omitempty"`
Edition string `bson:"edition,omitempty" json:"edition,omitempty"`
Events *[]InstanceEvent `bson:"events,omitempty" json:"events,omitempty"`
Headers *[]string `bson:"headers,omitempty" json:"headers,omitempty"`
ImportTasks *InstanceImportTasks `bson:"import_tasks,omitempty" json:"import_tasks,omitempty"`
LatestChanges []LatestChange `bson:"latest_changes,omitempty" json:"latest_changes,omitempty"`
Links InstanceLinks `bson:"links,omitempty" json:"links,omitempty"`
ReleaseDate string `bson:"release_date,omitempty" json:"release_date,omitempty"`
State string `bson:"state,omitempty" json:"state,omitempty"`
Temporal []TemporalFrequency `bson:"temporal,omitempty" json:"temporal,omitempty"`
TotalObservations int64 `bson:"total_observations,omitempty" json:"total_observations,omitempty"`
Version int `bson:"version,omitempty" json:"version,omitempty"`
LastUpdated time.Time `bson:"last_updated,omitempty" json:"last_updated,omitempty"`
UniqueTimestamp bson.MongoTimestamp `bson:"unique_timestamp" json:"-"`
}
Instance which presents a single dataset being imported
func GetInstance ¶
GetInstance retrieves an instance document from mongo
type InstanceEvent ¶
type InstanceEvent struct {
Message string `bson:"message,omitempty" json:"message,omitempty"`
MessageOffset string `bson:"message_offset,omitempty" json:"message_offset,omitempty"`
Type string `bson:"type,omitempty" json:"type,omitempty"`
}
InstanceEvent represents the event structure against an instance until it is deprecated to the event structure below
type InstanceImportTasks ¶
type InstanceImportTasks struct {
ImportObservations *ImportObservationsTask `bson:"import_observations,omitempty" json:"import_observations,omitempty"`
BuildHierarchyTasks []*BuildHierarchyTask `bson:"build_hierarchies,omitempty" json:"build_hierarchies,omitempty"`
SearchTasks []*BuildSearchIndexTask `bson:"build_search_indexes,omitempty" json:"build_search_indexes,omitempty"`
}
InstanceImportTasks represent an object containing specific lists of tasks for import process
type InstanceLinks ¶
type InstanceLinks struct {
Job *IDLink `bson:"job,omitempty" json:"job"`
Dataset *IDLink `bson:"dataset,omitempty" json:"dataset,omitempty"`
Dimensions *IDLink `bson:"dimensions,omitempty" json:"dimensions,omitempty"`
Edition *IDLink `bson:"edition,omitempty" json:"edition,omitempty"`
Version *IDLink `bson:"version,omitempty" json:"version,omitempty"`
Self *IDLink `bson:"self,omitempty" json:"self,omitempty"`
Spatial *IDLink `bson:"spatial,omitempty" json:"spatial,omitempty"`
}
InstanceLinks holds all links for an instance
type LatestChange ¶
type LatestChange struct {
Description string `bson:"description,omitempty" json:"description,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
Type string `bson:"type,omitempty" json:"type,omitempty"`
}
LatestChange represents an object contining information on a single change between versions
type LinkMap ¶
type LinkMap struct {
Dimensions LinkObject `bson:"dimensions" json:"dimensions,omitempty"`
FilterBlueprint LinkObject `bson:"filter_blueprint" json:"filter_blueprint,omitempty"`
Self LinkObject `bson:"self" json:"self,omitempty"`
Version LinkObject `bson:"version" json:"version,omitempty"`
}
LinkMap contains a named LinkObject for each link to other resources
type LinkObject ¶
type LinkObject struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
HRef string `bson:"href,omitempty" json:"href,omitempty"`
}
LinkObject represents a generic structure for all links
type Publisher ¶
type Publisher struct {
Name string `bson:"name,omitempty" json:"name,omitempty"`
Type string `bson:"type,omitempty" json:"type,omitempty"`
HRef string `bson:"href,omitempty" json:"href,omitempty"`
}
Publisher represents an object containing information of the publisher
type TemporalFrequency ¶
type TemporalFrequency struct {
EndDate string `bson:"end_date,omitempty" json:"end_date,omitempty"`
Frequency string `bson:"frequency,omitempty" json:"frequency,omitempty"`
StartDate string `bson:"start_date,omitempty" json:"start_date,omitempty"`
}
TemporalFrequency represents a frequency for a particular period of time
type Version ¶
type Version struct {
Alerts *[]Alert `bson:"alerts,omitempty" json:"alerts,omitempty"`
CollectionID string `bson:"collection_id,omitempty" json:"collection_id,omitempty"`
Dimensions []CodeList `bson:"dimensions,omitempty" json:"dimensions,omitempty"`
Downloads *DownloadList `bson:"downloads,omitempty" json:"downloads,omitempty"`
Edition string `bson:"edition,omitempty" json:"edition,omitempty"`
ID string `bson:"id,omitempty" json:"id,omitempty"`
LatestChanges []LatestChange `bson:"latest_changes,omitempty" json:"latest_changes,omitempty"`
Links *VersionLinks `bson:"links,omitempty" json:"links,omitempty"`
ReleaseDate string `bson:"release_date,omitempty" json:"release_date,omitempty"`
State string `bson:"state,omitempty" json:"state,omitempty"`
Temporal []TemporalFrequency `bson:"temporal,omitempty" json:"temporal,omitempty"`
LastUpdated time.Time `bson:"last_updated,omitempty" json:"-"`
Version int `bson:"version,omitempty" json:"version,omitempty"`
UsageNotes *[]UsageNote `bson:"usage_notes,omitempty" json:"usage_notes,omitempty"`
}
Version represents information related to a single version for an edition of a dataset
func GetVersion ¶
GetVersion retrieves a version document from mongo
type VersionLinks ¶
type VersionLinks struct {
Dataset *LinkObject `bson:"dataset,omitempty" json:"dataset,omitempty"`
Dimensions *LinkObject `bson:"dimensions,omitempty" json:"dimensions,omitempty"`
Edition *LinkObject `bson:"edition,omitempty" json:"edition,omitempty"`
Self *LinkObject `bson:"self,omitempty" json:"self,omitempty"`
Spatial *LinkObject `bson:"spatial,omitempty" json:"spatial,omitempty"`
Version *LinkObject `bson:"version,omitempty" json:"-"`
}
VersionLinks represents a list of specific links related to the version resource for an edition of a dataset