utils

package
v0.0.0-...-13248b8 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MTA_API_KEY = "ny459qNK3B9V8B6MiY3FD7I2GFBzeUTG7qvqRHQe"
View Source
var SUBWAY_LINE_REQUEST_URLS = map[string]string{
	"L":       "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-l",
	"ACE":     "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-ace",
	"BDFM":    "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-bdfm",
	"G":       "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-g",
	"JZ":      "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-jz",
	"NQRW":    "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-nqrw",
	"NUMBERS": "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs",
	"SERVICE": "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/camsys%2Fsubway-alerts.json",
}

Functions

func ConvertToTrainSliceAndParse

func ConvertToTrainSliceAndParse(stopTimeUpdateSlice []*types.StopTimeUpdate) ([]*types.Train, types.ParsedByDirection)

ConvertToTrainSliceAndParse Function

func DefaultSort

func DefaultSort(parsed types.ParsedByDirection) types.ParsedByDirection

DefaultSort Function

func DescendingSort

func DescendingSort(parsed types.ParsedByDirection) types.ParsedByDirection

DescendingSort Function

func FindStopData

func FindStopData(update *gtfs.TripUpdate_StopTimeUpdate, stopID string) (bool, *types.StopTimeUpdate)

FindStopData Function

func HandleFetchTransitData

func HandleFetchTransitData(subwayLine string) []*gtfs.TripUpdate_StopTimeUpdate

func TestGen

TestGen Function

Types

type ParsedStationMap

type ParsedStationMap struct {
	Stations          []Station            `json:"stations"`
	StationsByBorough map[string][]Station `json:"stationsByBorough"`
}

type StaticData

type StaticData struct {
	Map SubwayStationMap `json:"map"`
}

type Station

type Station struct {
	StationID      string `json:"stationId"`
	ComplexID      string `json:"complexId"`
	StopID         string `json:"stopID"`
	SubwayLine     string `json:"subwayLine"`
	StopName       string `json:"stopName"`
	Borough        string `json:"borough"`
	Routes         string `json:"routes"`
	Lattitude      string `json:"lattitude"`
	Longitude      string `json:"longitude"`
	NorthDirection string `json:"northDirectionLabel"`
	SouthDirection string `json:"southDirectionLabel"`
}

Station struct

type SubwayStationMap

SubwayStationMap is a slice of stations mapped to a subway line

func Process

func Process() SubwayStationMap

Process function

Jump to

Keyboard shortcuts

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