Documentation ¶
Overview ¶
Package database implements tools and structures to search and access the series in the BDSICE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BDSICEDatabase ¶
type BDSICEDatabase struct { Series map[string]string `json:"Series"` // code: title LastUpdate time.Time `json:"LastUpdate"` DatabasePath string `json:"Path"` Codes []string `json:"Codes"` }
func BuildDatabase ¶
func BuildDatabase(seriesToBuild []*series.BDSICESerie) (*BDSICEDatabase, error)
builds a db.json file from a BDSICEDatabase object from an array of pointers of series.BDSICESerie objects Intented to be called from download.DownloadFullDatabase() or download.Update() at some point after having downloaded or updated the database of .json files
func LoadDatabase ¶
func LoadDatabase(configuration *config.BDSICEConfig) (*BDSICEDatabase, error)
loads a database from database path specified in configuration and returns a reference to a database object
func (*BDSICEDatabase) AddSerie ¶
func (db *BDSICEDatabase) AddSerie(serie *series.BDSICESerie) error
Adds a BDSICEDatabaseSerie object to a BDSICEDatabase from a BDSICESerie Basically, it takes SerieCode and Title fields of BDSICESerie and appends them to the array of BDSICEDatabaseSerie objects
func (*BDSICEDatabase) GetCodes ¶
func (db *BDSICEDatabase) GetCodes() []string
returns a string slice containing a list of all the codes in the database
func (*BDSICEDatabase) Match ¶
func (db *BDSICEDatabase) Match(terms ...string) map[string]string
returns the series that contain all of the terms either in the title or in the serie code Match() does not normalize the search terms and the calling function should be responsible of performing any normalisation of diacritics and others that might me deemed necessary. Normalisations at this levels would reduce performance.