Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDimensionOptions(reader io.Reader) ([]string, error)
- func CreatePatches(reader io.Reader) ([]dprequest.Patch, error)
- func ValidateFilterBlueprintUpdate(filter *Filter) error
- func ValidateFilterDimensions(filterDimensions []Dimension, dimensions *dataset.VersionDimensions) error
- type Dataset
- type Dimension
- type DimensionItemLinks
- type DownloadItem
- type Downloads
- type DuplicateDimensionError
- type Event
- type Filter
- type LinkMap
- type LinkObject
- type NewFilter
- type PublicDimension
- type PublicDimensionLinkMap
- type PublicDimensionOption
- type PublicDimensionOptionLinkMap
- type PublicDimensionOptions
- type PublicDimensions
- type UpdateDimensionResponse
- type Version
- type VersionLinks
Constants ¶
const ( EventFilterOutputCreated = "FilterOutputCreated" EventFilterOutputQueryStart = "FilterOutputQueryStart" EventFilterOutputQueryEnd = "FilterOutputQueryEnd" EventFilterOutputCSVGenStart = "FilterOutputCSVGenStart" EventFilterOutputCSVGenEnd = "FilterOutputCSVGenEnd" EventFilterOutputXLSXGenStart = "FilterOutputXLSXGenStart" EventFilterOutputXLSXGenEnd = "FilterOutputXLSXGenEnd" EventFilterOutputCompleted = "FilterOutputCompleted" )
A list of event types
const ( CreatedState = "created" CompletedState = "completed" )
A list of states
Variables ¶
var ( Unpublished = false Published = true )
var ( ErrorReadingBody = errors.New("failed to read message body") ErrorParsingBody = errors.New("failed to parse json body") ErrorNoData = errors.New("bad request - missing data in body") )
A list of errors returned from package
Functions ¶
func CreateDimensionOptions ¶
CreateDimensionOptions manages the creation of options for a dimension from a reader
func CreatePatches ¶
CreatePatches manages the creation of an array of patch structs from the provided reader, and validates them
func ValidateFilterBlueprintUpdate ¶
ValidateFilterBlueprintUpdate checks the content of the filter structure for changes against the dataset
func ValidateFilterDimensions ¶
func ValidateFilterDimensions(filterDimensions []Dimension, dimensions *dataset.VersionDimensions) error
ValidateFilterDimensions checks the selected filter dimension are valid for a version of a dataset
Types ¶
type Dataset ¶
type Dataset struct { ID string `bson:"id" json:"id"` Edition string `bson:"edition" json:"edition"` Version int `bson:"version" json:"version"` }
Dataset contains the uniique identifiers that make a dataset unique
type Dimension ¶
type Dimension struct { URL string `bson:"dimension_url,omitempty" json:"dimension_url,omitempty"` Name string `bson:"name" json:"name"` Options []string `bson:"options,omitempty" json:"options"` IsAreaType *bool `bson:"is_area_type,omitempty" json:"is_area_type,omitempty"` }
Dimension represents an object containing a list of dimension values and the dimension name
func (*Dimension) EncodedOptions ¶
EncodedOptions returns the list of options for this dimension after escaping the values for URL query paramters
type DimensionItemLinks ¶
type DimensionItemLinks struct { Filter LinkObject `json:"filter"` Options LinkObject `json:"options"` Self LinkObject `json:"self"` }
type DownloadItem ¶
type DownloadItem struct { Skipped bool `bson:"skipped,omitempty" json:"skipped,omitempty"` 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 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 DuplicateDimensionError ¶
type DuplicateDimensionError struct {
// contains filtered or unexported fields
}
DuplicateDimensionError is returned if a request contains a duplicate dimension
func (DuplicateDimensionError) Error ¶
func (e DuplicateDimensionError) Error() string
type Event ¶
type Event struct { Type string `bson:"type,omitempty" json:"type"` Time time.Time `bson:"time,omitempty" json:"time"` }
Event captures the time certain stages of filter response were completed
type Filter ¶
type Filter struct { UniqueTimestamp primitive.Timestamp `bson:"unique_timestamp,omitempty" json:"-"` LastUpdated time.Time `bson:"last_updated" json:"-"` ETag string `bson:"e_tag" json:"-"` ID string `bson:"id" json:"id,omitempty"` Dataset *Dataset `bson:"dataset" json:"dataset"` InstanceID string `bson:"instance_id" json:"instance_id"` 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"` Published *bool `bson:"published,omitempty" json:"published,omitempty"` Links LinkMap `bson:"links" json:"links,omitempty"` Type string `bson:"type,omitempty" json:"type,omitempty"` }
Filter represents a structure for a filter job
func CreateFilter ¶
CreateFilter manages the creation of a filter from a reader
func (*Filter) Hash ¶
Hash generates a SHA-1 hash of the filter struct. SHA-1 is not cryptographically safe, but it has been selected for performance as we are only interested in uniqueness. ETag field value is ignored when generating a hash. An optional byte array can be provided to append to the hash. This can be used, for example, to calculate a hash of this filter and an update applied to it.
func (*Filter) RemoveDuplicateEvents ¶
func (*Filter) ValidateFilterOutputUpdate ¶
ValidateFilterOutputUpdate checks the content of the filter structure
type LinkMap ¶
type LinkMap struct { Dimensions *LinkObject `bson:"dimensions" json:"dimensions,omitempty"` FilterOutput *LinkObject `json:"filter_output,omitempty"` FilterBlueprint *LinkObject `bson:"filter_blueprint,omitempty" 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" json:"href,omitempty"` }
LinkObject represents a generic structure for all links
type NewFilter ¶
type NewFilter struct { Dataset *Dataset `bson:"dataset" json:"dataset"` Dimensions []Dimension `bson:"dimensions,omitempty" json:"dimensions,omitempty"` }
NewFilter creates a filter by using the dataset id, edition and version
func CreateNewFilter ¶
CreateNewFilter manages the creation of a filter blueprint being updated (new filter)
func (*NewFilter) ValidateNewFilter ¶
ValidateNewFilter checks the content of the filter structure
type PublicDimension ¶
type PublicDimension struct { Name string `bson:"name" json:"name"` Links *PublicDimensionLinkMap `bson:"links" json:"links"` }
PublicDimension represents information about a single dimension as served by /dimensions and /dimensions/<id>
type PublicDimensionLinkMap ¶
type PublicDimensionLinkMap struct { Self *LinkObject `bson:"self" json:"self"` Filter *LinkObject `bson:"filter" json:"filter"` Options *LinkObject `bson:"options" json:"options,omitempty"` }
PublicDimensionLinkMap is the links map for the PublicDimension structure
type PublicDimensionOption ¶
type PublicDimensionOption struct { Links *PublicDimensionOptionLinkMap `bson:"links" json:"links"` Option string `bson:"option" json:"option"` }
PublicDimensionOption represents information about a single dimension option as served by /options and /options/<id>
type PublicDimensionOptionLinkMap ¶
type PublicDimensionOptionLinkMap struct { Self *LinkObject `bson:"self" json:"self"` Filter *LinkObject `bson:"filter" json:"filter"` Dimension *LinkObject `bson:"dimension" json:"dimension"` }
PublicDimensionOptionLinkMap is the links map for the PublicDimensionOption structure
type PublicDimensionOptions ¶
type PublicDimensionOptions struct { Items []*PublicDimensionOption `json:"items"` Count int `json:"count"` Offset int `json:"offset"` Limit int `json:"limit"` TotalCount int `json:"total_count"` }
PublicDimensionOptions represents information about a set of dimension options
type PublicDimensions ¶
type PublicDimensions struct { Items []*PublicDimension `json:"items"` Count int `json:"count"` Offset int `json:"offset"` Limit int `json:"limit"` TotalCount int `json:"total_count"` }
type UpdateDimensionResponse ¶
type UpdateDimensionResponse struct { ID string `json:"id"` Name string `json:"name"` Label string `json:"label"` Links DimensionItemLinks `json:"links"` }
type Version ¶
type Version struct { ID string `json:"id,omitempty"` Links VersionLinks `json:"links,omitempty"` State string `json:"state,omitempty"` Version int `json:"version,omitempty"` }
Version represents the json returned from the dataset API for a version resource
type VersionLinks ¶
type VersionLinks struct { Dataset *LinkObject `bson:"dataset,omitempty" json:"dataset"` Edition *LinkObject `bson:"edition,omitempty" json:"edition"` Self *LinkObject `bson:"self,omitempty" json:"self"` Version *LinkObject `bson:"version,omitempty" json:"version"` }
VersionLinks represents a list of link objects related to the version resource