hof

package
v0.0.0-...-8b849f6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 GetMake

func GetMake(sentence string) string

func GetModel

func GetModel(sentence string) string

func PrintCars

func PrintCars(title string, cars Collection)

func PrintCars2

func PrintCars2(title string, cars CarCollection)

func UpgradeLabel

func UpgradeLabel(car string) string

Types

type Car

type Car string

type CarCollection

type CarCollection []CarType

type CarType

type CarType struct {
	Make  string `json:"make"`
	Model string `json:"model"`
}

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

type FilterFunc func(string) bool

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

type IndexedCar struct {
	Index int    `json:"index"`
	Car   string ` json:"car"`
}

func GetThisCar

func GetThisCar(carIndex int) (*IndexedCar, error)

retrieve performs a HTTP Get request for the rss feed and decodes the results.

type MapFunc

type MapFunc func(string) string

func Downgrade

func Downgrade() MapFunc

func Upgrade

func Upgrade() MapFunc

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

Jump to

Keyboard shortcuts

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