Documentation
¶
Overview ¶
Package data contains the structure of all the data and is used to encode/decode JSON or XML format
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFileNotFound = errors.New("File not found.")
ErrFileNotFound is used when try to load a file and that file does not exist
Functions ¶
func LoadType ¶
func LoadType(i Identifier, root string) error
LoadType loads the data from the data folder for a given type That type needs to implement the identifier interface.
func MakePath ¶
func MakePath(i Identifier, root string) string
MakePath generates the path to a identifier, when a root folder is given.
func SaveType ¶
func SaveType(i Identifier, root string) error
SaveType stores the data from a type into the data folder. The type needs to implement the Identifier interface.
Types ¶
type Area ¶
type Area struct { ID string `xml:"id,attr" json:"areaID"` Rect Fabric `xml:"rect" json:"rect"` Shape string `xml:"shape" json:"Shape"` Coords string `xml:"coords" json:"Coords"` Persons []string `xml:"persons" json:"Persons"` Text string `xml:"text" json:"Text"` Links []Link `xml:"links" json:"Links"` }
Area defines parts of the picture
type Fabric ¶
type Fabric struct { Type string `xml:"type" json:"type"` Left float32 `xml:"left" json:"left"` Top float32 `xml:"top" json:"top"` Width int `xml:"width" json:"width"` Height int `xml:"height" json:"height"` Fill string `xml:"fill" json:"fill"` Opacity float32 `xml:"opacity" json:"opacity"` ScaleX float32 `xml:"scaleX" json:"scaleX"` ScaleY float32 `xml:"scaleY" json:"scaleY"` HasRotatingPoint bool `xml:"hasRotatingPoint" json:"hasRotatingPoint"` }
Fabric defines rects of the fabricjs library
type Ident ¶
type Ident struct { Value string `xml:"value" json:"Value"` Type string `xml:"type,attr" json:"Type"` }
Ident is a unique identification
type Identifier ¶
Identifier is used to get the ID of a type. That ID is used to generate the filepath for saving the data.
type Link ¶
type Link struct { URL string `xml:"url" json:"Url"` Text string `xml:"text" json:"Text"` Title string `xml:"title" json:"Title"` }
Link for a part of the blog
type Person ¶
type Person struct { ID int `xml:"id,attr" json:"intID"` GND string `xml:"gnd" json:"GND"` ExtID string `xml:"gnd" json:"personID"` Idents []Ident `xml:"idents" json:"idents"` MasterID int `xml:"master,attr" json:"masterID"` Type string `xml:"type,attr" json:"Type"` NameFamily string `xml:"name>family" json:"FamilyName"` NameGiven string `xml:"name>given" json:"GivenName"` FullName string `xml:"fullName" json:"FullName"` YearBirth int `xml:"yearBirth" json:"YearBirth"` YearDeath int `xml:"yearDeath" json:"YearDeath"` CityBirth string `xml:"cityBirth" json:"CityBirth"` CityDeath string `xml:"cityDeath" json:"CityDeath"` Text string `xml:"text" json:"Text"` ProfilePics map[string]Source `xml:"profilePics" json:"ProfilePics"` Pictures []string `xml:"pictures" json:"Pictures"` Links []Link `xml:"links" json:"Links"` }
Person represents the entities of a person
type PersonDBer ¶
type PersonDBer interface { AddPerson(*Person) GetPerson(string) (*Person, bool) GetAll() map[string]Person SavePerson(p *Person) error }
PersonDBer is the interface for a simple PersonDB
type Picture ¶
type Picture struct { ID string `xml:"id,attr" json:"ID"` SrcPath string `xml:"-" json:"-"` File string `xml:"-" json:"-"` Title string `xml:"title" json:"Title"` Topic string `xml:"topic" json:"Topic"` Text string `xml:"text" json:"Text"` CanvasWidth int `xml:"canvasWidth" json:"canvasWidth"` CanvasHeight int `xml:"canvasHeight" json:"canvasHeight"` Areas []Area `xml:"areas" json:"Areas"` Captured int `xml:"captured" json:"Captured"` //Year, when picture was digitalized Place string `xml:"place" json:"Place"` //Place where the picture was issued YearIssued string `xml:"yearIssued" json:"YearIssued"` Persons []string `xml:"persons" json:"Persons"` Tags []string `xml:"tags" json:"Tags"` Links []Link `xml:"links" json:"Links"` Status string `xml:"status" json:"Status"` BlogDate time.Time `xml:"-" json:"BlogDate"` PublishDate time.Time `xml:"-" json:"PublishDate"` }
Picture stores all the entities for the histblogger
func LoadPictures ¶
LoadPictures loads the pictures from data folder. For loading the pictures the data.LoadType function is used.