Documentation
¶
Index ¶
- Constants
- Variables
- func GetAllStops(e []Endpointer) (chan []pb.Stop, chan error)
- func GetDepartures(e []Endpointer, shortName uint) (chan []pb.Departure, chan error)
- func GetDeparturesErrorCode(e Endpointer, id uint) (errorCode int)
- type Endpoint
- type Endpointer
- type ErrRequestFailed
- type ErrStatusCode
- type ErrStopNotFound
Constants ¶
View Source
const ( OK = iota OTHER_ERROR // Please check logs for detailed error REQUEST_FAILED // Request failed REQUEST_NON_200 // Request returned non 200 status code EMPTY_DEPARTURES // No departures received (with 200 status code) STOP_NOT_FOUND // Stop was not found )
Errors below are sorted by severity - we care the most on the request that succeded, but returned no departures
Variables ¶
View Source
var ( BusEndpoint = Endpoint{ URL: "http://91.223.13.70", Type: pb.Endpoint_BUS, } TramEndpoint = Endpoint{ URL: "http://185.70.182.51", Type: pb.Endpoint_TRAM, } KrkStopsEndpoints = []Endpointer{ BusEndpoint, TramEndpoint, } )
Functions ¶
func GetAllStops ¶
func GetAllStops(e []Endpointer) (chan []pb.Stop, chan error)
GetAllStops returns stops from multiple endpoints. When one endpoint fails, valid stops are returned and error is send via chan. When request is finished, error channel is closed.
func GetDepartures ¶ added in v0.2.0
func GetDepartures(e []Endpointer, shortName uint) (chan []pb.Departure, chan error)
GetDepartures for range of endpoints. When one endpoint fails, valid departures are returned and error is send via chan. When request is finished, error channel is closed.
func GetDeparturesErrorCode ¶ added in v0.2.0
func GetDeparturesErrorCode(e Endpointer, id uint) (errorCode int)
GetDeparturesErrorCode returns error that can be consumed by e.g. Prometheus.
Types ¶
type Endpoint ¶
func (Endpoint) GetAllStops ¶ added in v0.2.0
GetAllStops fetches Stops from given endpoint.
func (Endpoint) GetDepartures ¶ added in v0.2.0
GetDepartures from Endpoint for stop with given shortName.
type Endpointer ¶ added in v0.2.0
type ErrRequestFailed ¶ added in v0.2.0
type ErrRequestFailed struct {
// contains filtered or unexported fields
}
func (ErrRequestFailed) Error ¶ added in v0.2.0
func (e ErrRequestFailed) Error() string
type ErrStatusCode ¶ added in v0.2.0
type ErrStatusCode struct {
// contains filtered or unexported fields
}
func (ErrStatusCode) Error ¶ added in v0.2.0
func (e ErrStatusCode) Error() string
type ErrStopNotFound ¶ added in v0.4.0
type ErrStopNotFound struct { }
func (ErrStopNotFound) Error ¶ added in v0.4.0
func (e ErrStopNotFound) Error() string
Click to show internal directories.
Click to hide internal directories.