manipulatefragranceitems

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MASTER string

MASTER is the master collecion filepath, when an item is added, master is regenerated in alphabetical order

View Source
var PATH string

PATH is the location of the directory where the jsons are stored

Functions

func AddToCollection

func AddToCollection(url string) bool

AddToCollection takes a url string and builds the corresponding fragrance item and adds it to the JSON

func ManualUpdate

func ManualUpdate()

ManualUpdate updates the rest of the json file when called, for example if someone were to manually add something to the file

func RemoveFromCollection

func RemoveFromCollection()

RemoveFromCollection takes the name of the fragrance to remove, removes it from the collection and then regenerated the json file

func Search(url, nameToSearch string)

Search goes through the search page on basenotes and tries to find a match, otherwise it gives the available options

func SearchByHouse

func SearchByHouse(house, name string)

SearchByHouse searches basenotes by fragrance house first and then by

func SearchByName

func SearchByName(name string)

SearchByName will do a search on BaseNotes for the fragrance name inputted, if no exact match is found, a list of options will be given

func SetPath

func SetPath()

SetPath determines what the path should be based on the OS

func ShowOptionsAndGetNumericInput

func ShowOptionsAndGetNumericInput(collection FragranceCollection) int

ShowOptionsAndGetNumericInput displays the fragrances in the collection and gets the users selection

func ShowOptionsByBrandAndGetNumericInput

func ShowOptionsByBrandAndGetNumericInput(collection FragranceCollection) int

ShowOptionsByBrandAndGetNumericInput displays the fragrances by brand and get the selection

Types

type BasicInfo

type BasicInfo struct {
	Name        string
	House       string
	ReleaseYear string
}

BasicInfo of a fragrance Item will contain only it's name, house and release year

type FragranceCollection

type FragranceCollection struct {
	MasterCollection  map[string]FragranceItem
	FragrancesByName  []BasicInfo
	FragrancesByHouse []BasicInfo
	Notes             map[string][]BasicInfo
}

FragranceCollection is used to hold a collection of FragranceItems

func ReadInCollection

func ReadInCollection(filePath string) FragranceCollection

ReadInCollection reads a file and outputs a FragranceCollection

type FragranceItem

type FragranceItem struct {
	BasicInfo
	FlatNotes []string
	Pyramid   notesPyramid
	Link      string
	Blurb     string
}

FragranceItem type contains fragrance info and all notes in a pyramid (if applicable) and flat list of scent notes

func BuildFragranceItem

func BuildFragranceItem(url string) FragranceItem

BuildFragranceItem receives a URL (from basenotes fragrance directory) and returns a FragranceItem with the corresponding information

Jump to

Keyboard shortcuts

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