router

package
v0.0.1-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrimId

func TrimId(id string) string

Removes the "X:" prefix present on IDs from the OTP API (where X is the router ID)

Types

type Itinerary

type Itinerary struct {
	Legs []Leg `json:"legs"`
}

type Leg

type Leg struct {
	StartTime            int64        `json:"startTime"`
	EndTime              int64        `json:"endTime"`
	Mode                 string       `json:"mode"`
	TransitLeg           bool         `json:"transitLeg"`
	AgencyTimeZoneOffset int          `json:"agencyTimeZoneOffset"`
	AgencyId             string       `json:"agencyId"`
	ServiceDate          string       `json:"serviceDate"`
	From                 LegVertex    `json:"from"`
	To                   LegVertex    `json:"to"`
	LegGeometry          LegGeometry  `json:"legGeometry"`
	RouteShortName       string       `json:"routeShortName"`
	Fares                []fares.Fare `json:"fares"`
}

func FilterTransitLegs

func FilterTransitLegs(response TripPlannerResponse) []Leg

func (*Leg) GetFares

func (l *Leg) GetFares(c *pgx.Conn, n agency.Noc) (legFares []fares.Fare, err error)

GetFares finds the possible fares for the given transit leg and returns them

type LegGeometry

type LegGeometry struct {
	Points string `json:"points"`
	Length int    `json:"length"`
}

type LegVertex

type LegVertex struct {
	Name       string `json:"name"`
	StopId     string `json:"stopId"`
	VertexType string `json:"vertexType"`
}

type TripPlan

type TripPlan struct {
	Itineraries []Itinerary `json:"itineraries"`
}

type TripPlannerResponse

type TripPlannerResponse struct {
	Plan TripPlan `json:"plan"`
}

func ParseJson

func ParseJson(data []byte) (TripPlannerResponse, error)

func (*TripPlannerResponse) GetAllFares

func (r *TripPlannerResponse) GetAllFares(c *pgx.Conn, a *agency.Agencies) ([][][]fares.Fare, error)

GetAllFares returns a list of fares for each leg of the TripPlannerResponse, following the same structure

Jump to

Keyboard shortcuts

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