tchou

package
v0.0.0-...-2318a8d Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStationNotFound = errors.New("Station not found")
)

Functions

This section is empty.

Types

type Station

type Station struct {
	Name    string `json:"name"`
	Address string `json:"address"`

	Lat  float64 `json:"lat"`
	Long float64 `json:"long"`

	// Ref is a short unique reference to a station
	Ref string `json:"ref"`
	// contains filtered or unexported fields
}

A Station is a train station

func FindStationByRef

func FindStationByRef(ref string) (*Station, error)

FindStation returns a station given its ref

func (Station) URL

func (s Station) URL() string

URL is the URL of the station

type StationsList

type StationsList struct {
	// contains filtered or unexported fields
}

A StationsList is a list of stations

func GlobalList

func GlobalList() (*StationsList, error)

GlobalList returns the list of all stations

func (*StationsList) Get

func (sl *StationsList) Get(idx int) Station

Get returns the station at the given index in the list

func (*StationsList) GetStations

func (sl *StationsList) GetStations() []Station

GetStations return a slice with all stations at once

func (*StationsList) Len

func (sl *StationsList) Len() int

Len returns the number of stations in the list

func (*StationsList) More

func (sl *StationsList) More() bool

More checks if there are more stations available with Next()

func (*StationsList) Next

func (sl *StationsList) Next() Station

Next returns one station at a time. It is more effective when you need to process each station independently.

func (*StationsList) Print

func (l *StationsList) Print(writer io.Writer) error

func (*StationsList) WriteCSV

func (l *StationsList) WriteCSV(writer io.Writer) error

func (*StationsList) WriteJSON

func (l *StationsList) WriteJSON(writer io.Writer) error

Jump to

Keyboard shortcuts

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