models

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 1 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CodelistURL string

CodelistURL set by main() to make accessible to all models users

Functions

This section is empty.

Types

type Element

type Element struct {
	ID           string          `json:"-"`
	Label        string          `json:"label"`
	NoOfChildren int64           `json:"no_of_children,omitempty"`
	Links        map[string]Link `json:"links,omitempty"`
	HasData      bool            `json:"has_data"`
}

Element is a item in a list within a Response

func (e *Element) AddLinks(host, instanceID, dimensionName, codelistID string, withID bool)

AddLinks adds self and codelist links for Elements

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

Link is a combination of ID and HRef for the object in question

func GetLink(baseURL string, linkID string) *Link

GetLink returns a Link{id,href} object for the given url/id (or just url if id is empty)

func GetLinkWithID

func GetLinkWithID(baseURL string, linkID, id string) *Link

GetLinkWithID returns a Link{id,href} object for the given url/id (or just url if id is empty)

type Response

type Response struct {
	ID           string          `json:"-"`
	Label        string          `json:"label"`
	Children     []*Element      `json:"children,omitempty"`
	NoOfChildren int64           `json:"no_of_children,omitempty"`
	Links        map[string]Link `json:"links,omitempty"`
	HasData      bool            `json:"has_data"`
	Breadcrumbs  []*Element      `json:"breadcrumbs,omitempty"`
}

Response models a node in the hierarchy

func (r *Response) AddLinks(host, instanceID, dimensionName, codelistID string, isRoot bool)

AddLinks adds links (self, codelist and populates children links)

Jump to

Keyboard shortcuts

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