Documentation ¶
Index ¶
- Constants
- type BuildHierarchyTask
- type BuildSearchIndexTask
- type CodeList
- type DataBakerEvent
- type Event
- type IDLink
- type ImportData
- type ImportObservationsTask
- type Instance
- type InstanceImportTasks
- type InstanceLinks
- type Job
- type JobResults
- type LinksMap
- type Recipe
- type RecipeInstance
- type UploadedFile
Constants ¶
const ( CompletedState = "completed" CreatedState = "created" SubmittedState = "submitted" )
CreatedState represents onse possible state of the job resource
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 search index into search.
type DataBakerEvent ¶
type DataBakerEvent struct {
JobID string `avro:"job_id"`
}
DataBakerEvent used to trigger the databaker process
type Event ¶
type Event struct { Type string `json:"type"` Time string `json:"time"` Message string `json:"message"` MessageOffset string `json:"messageOffset"` }
Event which has happened to an instance
type ImportData ¶
type ImportData struct { JobID string Recipe string `json:"recipe,omitempty"` Format string `json:"format,omitempty"` UploadedFiles *[]UploadedFile `json:"files,omitempty"` InstanceIDs []string }
ImportData used to create a message to data baker or direct to the dimension-extractor
type ImportObservationsTask ¶
type ImportObservationsTask struct { State string `bson:"state,omitempty" json:"state,omitempty"` InsertedObservations int64 `bson:"total_inserted_observations" json:"total_inserted_observations"` }
ImportObservationsTask represents the task of importing instance observation data into the database.
type Instance ¶
type Instance struct { InstanceID string `json:"id,omitempty"` Links *InstanceLinks `json:"links,omitempty"` State string `json:"state,omitempty"` Events []Event `json:"events,omitempty"` TotalObservations int `json:"total_observations,omitempty"` Headers []string `json:"headers,omitempty"` Dimensions []CodeList `json:"dimensions,omitempty"` LastUpdated string `json:"last_updated,omitempty"` ImportTasks *InstanceImportTasks `json:"import_tasks"` }
Instance which presents a single dataset being imported
type InstanceImportTasks ¶
type InstanceImportTasks struct { ImportObservations *ImportObservationsTask `bson:"import_observations,omitempty" json:"import_observations"` BuildHierarchyTasks []*BuildHierarchyTask `bson:"build_hierarchies,omitempty" json:"build_hierarchies"` BuildSearchIndexTasks []*BuildSearchIndexTask `bson:"build_search_indexes,omitempty" json:"build_search_indexes"` }
InstanceImportTasks represents all of the tasks required to complete an import job.
type InstanceLinks ¶
type Job ¶
type Job struct { ID string `bson:"id,omitempty" json:"id,omitempty"` RecipeID string `bson:"recipe,omitempty" json:"recipe,omitempty"` State string `bson:"state,omitempty" json:"state,omitempty"` UploadedFiles *[]UploadedFile `bson:"files,omitempty" json:"files,omitempty"` Links LinksMap `bson:"links,omitempty" json:"links,omitempty"` LastUpdated time.Time `bson:"last_updated,omitempty" json:"last_updated,omitempty"` UniqueTimestamp bson.MongoTimestamp `bson:"unique_timestamp,omitempty" json:"-"` }
Job for importing datasets
func (*Job) ValidateState ¶
ValidateState checks the state is valid
type JobResults ¶
type JobResults struct {
Items []Job `json:"items"`
}
JobResults for list of Job items
type LinksMap ¶
type LinksMap struct { Instances []IDLink `bson:"instances,omitempty" json:"instances,omitempty"` Self IDLink `bson:"self,omitempty" json:"self,omitempty"` }
LinksMap represents a list of links related to a job resource
type Recipe ¶
type Recipe struct { ID string `json:"id"` Alias string `json:"alias"` Format string `json:"format,omitempty"` OutputInstances []RecipeInstance `json:"output_instances"` }
this should probably be replaced with an import of github.com/ONSdigital/dp-code-list-api/{pkg when unstubbed}
type RecipeInstance ¶
type UploadedFile ¶
type UploadedFile struct { AliasName string `bson:"alias_name" json:"alias_name" avro:"alias-name"` URL string `bson:"url" json:"url" avro:"url"` }
UploadedFile used for a file which has been uploaded to a bucket
func CreateUploadedFile ¶
func CreateUploadedFile(reader io.Reader) (*UploadedFile, error)
CreateUploadedFile from a json message
func (UploadedFile) Validate ¶
func (s UploadedFile) Validate() error
Validate the content of the structure