Documentation ¶
Index ¶
- Constants
- Variables
- func CarHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func CarsIndexHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func GetMake(sentence string) string
- func GetModel(sentence string) string
- func PrintCars(title string, cars Collection)
- func PrintCars2(title string, cars CarCollection)
- func UpgradeLabel(car string) string
- type Car
- type CarCollection
- type CarType
- type Collection
- func (cars Collection) AddCars(carsToAdd Collection) Collection
- func (cars Collection) Filter(fn FilterFunc) Collection
- func (cars Collection) GenerateCars(start, limit int) Collection
- func (cars Collection) Map(fn MapFunc) Collection
- func (cars Collection) Reduce(fn ReducerFunc, accumulator Collection) Collection
- func (cars Collection) Reduce2(fn ReducerFunc2, accumulator CarCollection) CarCollection
- type FilterFunc
- type IndexedCar
- type MapFunc
- type Payload
- type ReducerFunc
- type ReducerFunc2
Constants ¶
View Source
const DASHES = "-----------------------"
Variables ¶
View Source
var CarsDB = initCarsDB()
Functions ¶
func CarHandler ¶
func CarHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)
func CarsIndexHandler ¶
func CarsIndexHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)
func PrintCars ¶
func PrintCars(title string, cars Collection)
func PrintCars2 ¶
func PrintCars2(title string, cars CarCollection)
func UpgradeLabel ¶
Types ¶
type CarCollection ¶
type CarCollection []CarType
type Collection ¶
type Collection []string
func CsvToStruct ¶
func CsvToStruct(fileName string) Collection
func LoadCars ¶
func LoadCars() Collection
func LoadMoreCars ¶
func LoadMoreCars() Collection
func (Collection) AddCars ¶
func (cars Collection) AddCars(carsToAdd Collection) Collection
func (Collection) Filter ¶
func (cars Collection) Filter(fn FilterFunc) Collection
func (Collection) GenerateCars ¶
func (cars Collection) GenerateCars(start, limit int) Collection
func (Collection) Map ¶
func (cars Collection) Map(fn MapFunc) Collection
func (Collection) Reduce ¶
func (cars Collection) Reduce(fn ReducerFunc, accumulator Collection) Collection
Reduce collection based on the function
func (Collection) Reduce2 ¶
func (cars Collection) Reduce2(fn ReducerFunc2, accumulator CarCollection) CarCollection
type FilterFunc ¶
func ByDomestic ¶
func ByDomestic() FilterFunc
func ByForeign ¶
func ByForeign() FilterFunc
func ByHasNumber ¶
func ByHasNumber() FilterFunc
func ByMake ¶
func ByMake(make string) FilterFunc
func ByModel ¶
func ByModel(model string) FilterFunc
type IndexedCar ¶
func GetThisCar ¶
func GetThisCar(carIndex int) (*IndexedCar, error)
retrieve performs a HTTP Get request for the rss feed and decodes the results.
type Payload ¶
type Payload struct {
IndexedCars []IndexedCar
}
type ReducerFunc ¶
type ReducerFunc func(string, Collection) Collection // 1st arg: list to construct, 2nd: thing we are iterating
func JsonReducer ¶
func JsonReducer(cars Collection) ReducerFunc
func MakeReducer ¶
func MakeReducer(make string, cars Collection) ReducerFunc
type ReducerFunc2 ¶
type ReducerFunc2 func(string, CarCollection) CarCollection
func CarTypeReducer ¶
func CarTypeReducer(cars Collection) ReducerFunc2
Click to show internal directories.
Click to hide internal directories.