gtfs

package module
v0.0.0-...-bc5e768 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteTypeTram RouteType = iota
	RouteTypeSubway
	RouteTypeRail
	RouteTypeBus
	RouteTypeFerry
	RouteTypeCableTram
	RouteTypeAerialLift
	RouteTypeFunicular
	RouteTypeTrolleybus
	RouteTypeMonorail
	RouteTypeExtRail                             = 100
	RouteTypeExtHighSpeedRail                    = 101
	RouteTypeExtLongDistanceTrains               = 102
	RouteTypeExtInterRegionalRailService         = 103
	RouteTypeExtCarTransportRailService          = 104
	RouteTypeExtSleeperRailService               = 105
	RouteTypeExtRegionalRailService              = 106
	RouteTypeExtTouristRailwayService            = 107
	RouteTypeExtRailShuttleWithinComplex         = 108
	RouteTypeExtSuburbanRailway                  = 109
	RouteTypeExtReplacementRailService           = 110
	RouteTypeExtSpecialRailService               = 111
	RouteTypeExtLorryTransportRailService        = 112
	RouteTypeExtAllRailServices                  = 113
	RouteTypeExtCrossCountryRailService          = 114
	RouteTypeExtVehicleTransportRailService      = 115
	RouteTypeExtRackAndPinionRailway             = 116
	RouteTypeExtAdditionalRailService            = 117
	RouteTypeExtCoachService                     = 200
	RouteTypeExtInternationalCoachService        = 201
	RouteTypeExtNationalCoachService             = 202
	RouteTypeExtShuttleCoachService              = 203
	RouteTypeExtRegionalCoachService             = 204
	RouteTypeExtSpecialCoachService              = 205
	RouteTypeExtSightseeingCoachService          = 206
	RouteTypeExtTouristCoachService              = 207
	RouteTypeExtCommuterCoachService             = 208
	RouteTypeExtAllCoachServices                 = 209
	RouteTypeExtUrbanRailwayService              = 400
	RouteTypeExtMetroService                     = 401
	RouteTypeExtUndergroundService               = 402
	RouteTypeExtUrbanRailwayService2             = 403
	RouteTypeExtAllUrbanRailwayServices          = 404
	RouteTypeExtMonorail                         = 405
	RouteTypeExtBusService                       = 700
	RouteTypeExtRegionalBusService               = 701
	RouteTypeExtExpressBusService                = 702
	RouteTypeExtStoppingBusService               = 703
	RouteTypeExtLocalBusService                  = 704
	RouteTypeExtNightBusService                  = 705
	RouteTypeExtPostBusService                   = 706
	RouteTypeExtSpecialNeedsBus                  = 707
	RouteTypeExtMobilityBusService               = 708
	RouteTypeExtMobilityBusForRegisteredDisabled = 709
	RouteTypeExtSightseeingBus                   = 710
	RouteTypeExtShuttleBus                       = 711
	RouteTypeExtSchoolBus                        = 712
	RouteTypeExtSchoolAndPublicServiceBus        = 713
	RouteTypeExtRailReplacementBusService        = 714
	RouteTypeExtDemandAndResponseBusService      = 715
	RouteTypeExtAllBusServices                   = 716
	RouteTypeExtTrolleybusService                = 800
	RouteTypeExtTramService                      = 900
	RouteTypeExtCityTramService                  = 901
	RouteTypeExtLocalTramService                 = 902
	RouteTypeExtRegionalTramService              = 903
	RouteTypeExtSightseeingTramService           = 904
	RouteTypeExtShuttleTramService               = 905
	RouteTypeExtAllTramServices                  = 906
	RouteTypeExtWaterTransportService            = 1000
	RouteTypeExtAirService                       = 1100
	RouteTypeExtFerryService                     = 1200
	RouteTypeExtAerialLiftService                = 1300
	RouteTypeExtTelecabinService                 = 1301
	RouteTypeExtCableCarService                  = 1302
	RouteTypeExtElevatorService                  = 1303
	RouteTypeExtChairLiftService                 = 1304
	RouteTypeExtDragLiftService                  = 1305
	RouteTypeExtSmallTelecabinService            = 1306
	RouteTypeExtAllTelecabinServices             = 1307
	RouteTypeExtFunicularService                 = 1400
	RouteTypeExtTaxiService                      = 1500
	RouteTypeExtCommunalTaxiService              = 1501
	RouteTypeExtWaterTaxiService                 = 1502
	RouteTypeExtRailTaxiService                  = 1503
	RouteTypeExtBikeTaxiService                  = 1504
	RouteTypeExtLicensedTaxiService              = 1505
	RouteTypeExtPrivateHireServiceVehicle        = 1506
	RouteTypeExtAllTaxiServices                  = 1507
	RouteTypeExtMiscellaneousService             = 1700
	RouteTypeExtHorseDrawnCarriage               = 1702
)
View Source
const (
	GTFSDateFormat = "20060102"
)

Format constants, for use with Parse and the Date.Format method.

Variables

View Source
var ErrDuplicateEntity = fmt.Errorf("duplicate entity")
View Source
var ErrEmptySet = errors.New("empty set")
View Source
var ErrEmptyShape = errors.New("empty shape")
View Source
var ErrEntityAlreadySet = fmt.Errorf("entity already set, use Copy() to get a copy of the entity")
View Source
var ErrEnumOutOfRange = errors.New("enum out of range")
View Source
var ErrInvalidColor = errors.New("invalid color")
View Source
var ErrInvalidCurrencyCode = errors.New("invalid currency code")
View Source
var ErrInvalidDistanceTraveled = errors.New("invalid distance travelled")
View Source
var ErrInvalidEnumValue = errors.New("invalid enum value")
View Source
var ErrInvalidExactTime = errors.New("invalid exact_times")
View Source
var ErrInvalidSequence = errors.New("invalid sequence")
View Source
var ErrInvalidService = errors.New("invalid service")
View Source
var ErrInvalidTime = errors.New("invalid time")
View Source
var ErrInvalidTimePoint = errors.New("invalid timepoint")
View Source
var ErrKeyIDMismatch = errors.New("key and id mismatch")
View Source
var ErrMissingCSVColumn = fmt.Errorf("missing csv column")
View Source
var ErrMissingRequiredField = errors.New("missing required field")
View Source
var ErrNilEntity = fmt.Errorf("nil entity")
View Source
var ErrOutOfRange = errors.New("epochdate: dates must be in the range [1970-01-01,2149-06-06]")

ErrOutOfRange is returned if the input date is not a representable Date.

View Source
var ErrStationWithParentStation = errors.New("stations cannot have a parent station")
View Source
var ErrStreamNotFound = fmt.Errorf("file not found")
View Source
var ErrTripMissingStopTimes = errors.New("trip missing stop times")

Functions

func UnixInRange

func UnixInRange(seconds int64) bool

UnixInRange is true if the provided Unix timestamp is in Date's representable range. The timestamp is interpreted according to the semantics used by NewFromUnix. You probably won't need to use this, since this will only return false if NewFromUnix returns an error of ErrOutOfRange.

func Write

func Write(f *Feed, sp WriteStreamProvider) error

func WriteGOBFile

func WriteGOBFile(feed *Feed, path string) error

func WriteGOBStream

func WriteGOBStream(feed *Feed, w io.Writer) error

func WriteTxtarFile

func WriteTxtarFile(filename string, feed *Feed) error

WriteTxtarFile writes a feed to a txtar file. Useful for creating unit tests.

func WriteZip

func WriteZip(feed *Feed, wc io.WriteCloser) error

func WriteZipFile

func WriteZipFile(feed *Feed, path string) error

Types

type AbsoluteStopTime

type AbsoluteStopTime struct {
	ArrivalTime   Time
	DepartureTime Time
	StopTime
}

func (*AbsoluteStopTime) ID

func (fe *AbsoluteStopTime) ID() string

func (*AbsoluteStopTime) SetAdditionalField

func (fe *AbsoluteStopTime) SetAdditionalField(k, v string)

type AbsoluteStopTimes

type AbsoluteStopTimes []AbsoluteStopTime

type Agencies

type Agencies map[string]*Agency

func (*Agencies) Validate

func (a *Agencies) Validate(opts ...ValidationOpts) error

type Agency

type Agency struct {
	Name     string // Required. Full name of the transit agency.
	URL      string // Required. URL of the transit agency.
	Timezone string // Required. Timezone where the transit agency is located. If multiple agencies are specified in the dataset, each must have the same agency_timezone.
	Lang     string // Optional. Primary language used by this transit agency. Should be provided to help GTFS consumers choose capitalization rules and other language-specific settings for the dataset.
	Phone    string // Optional. A voice telephone number for the specified agency. This field is a string value that presents the telephone number as typical for the agency's service area. It may contain punctuation marks to group the digits of the number. Dialable text (for example, TriMet's "503-238-RIDE") is permitted, but the field must not contain any other descriptive text.
	FareURL  string // Optional. URL of a web page that allows a rider to purchase tickets or other fare instruments for that agency online.
	Email    string // Optional. Email address actively monitored by the agency’s customer service department. This email address should be a direct contact point where transit riders can reach a customer service representative at the agency.
	// contains filtered or unexported fields
}

func (*Agency) Copy

func (a *Agency) Copy() *Agency

func (*Agency) ID

func (fe *Agency) ID() string

func (*Agency) SetAdditionalField

func (fe *Agency) SetAdditionalField(k, v string)

func (*Agency) Validate

func (a *Agency) Validate(opts ...ValidationOpts) error

type Area

type Area struct {
	Name string // Optional
	// contains filtered or unexported fields
}

func (*Area) ID

func (fe *Area) ID() string

func (*Area) SetAdditionalField

func (fe *Area) SetAdditionalField(k, v string)

func (*Area) Stops

func (a *Area) Stops() []*Stop

func (*Area) Validate

func (a *Area) Validate(opts ...ValidationOpts) error

type Areas

type Areas map[string]*Area

func (*Areas) Validate

func (a *Areas) Validate(opts ...ValidationOpts) error

type Attribution

type Attribution struct {
	AgencyID         string // Optional
	RouteID          string // Optional
	TripID           string // Optional
	OrganizationName string // Required
	IsProducer       bool   // Optional
	IsOperator       bool   // Optional
	IsAuthority      bool   // Optional
	URL              string // Optional
	Email            string // Optional
	Phone            string // Optional
	// contains filtered or unexported fields
}

func (*Attribution) Agency

func (a *Attribution) Agency() *Agency

func (*Attribution) ID

func (fe *Attribution) ID() string

func (*Attribution) Route

func (a *Attribution) Route() *Route

func (*Attribution) SetAdditionalField

func (fe *Attribution) SetAdditionalField(k, v string)

func (*Attribution) Trip

func (a *Attribution) Trip() *Trip

func (*Attribution) Validate

func (a *Attribution) Validate() error

type Attributions

type Attributions map[string]*Attribution

func (*Attributions) Validate

func (a *Attributions) Validate() error

type BikeInformation

type BikeInformation int
const (
	BikesNoInformation BikeInformation = iota
	BikesAllowed
	BikesNotAllowed
)

func (*BikeInformation) Parse

func (bi *BikeInformation) Parse(s string) error

func (BikeInformation) String

func (bi BikeInformation) String() string

func (*BikeInformation) Validate

func (bi *BikeInformation) Validate() error

type Color

type Color uint32

A color encoded as a six-digit hexadecimal number. Refer to https://htmlcolorcodes.com to generate a valid value (the leading "#" must not be included). Example: FFFFFF for white, 000000 for black or 0039A6 for the A,C,E lines in NYMTA.

func (*Color) Parse

func (c *Color) Parse(text string) error

func (*Color) String

func (c *Color) String() string

type ConflictBehaviour

type ConflictBehaviour uint8
const (
	ConflictError ConflictBehaviour = iota
	ConflictIgnore
	ConflictOverwrite
)

type ContinuousDropOff

type ContinuousDropOff int8
const (
	ContinuousDropOffRegular ContinuousDropOff = iota
	ContinuousDropOffNotAllowed
	ContinuousDropOffMustPhone
	ContinuousDropOffMustCoordinate
)

func (*ContinuousDropOff) Parse

func (p *ContinuousDropOff) Parse(text string) error

func (ContinuousDropOff) String

func (p ContinuousDropOff) String() string

func (ContinuousDropOff) Validate

func (p ContinuousDropOff) Validate() error

type ContinuousPickup

type ContinuousPickup int8
const (
	ContinuousPickupRegular ContinuousPickup = iota
	ContinuousPickupNotAllowed
	ContinuousPickupMustPhone
	ContinuousPickupMustCoordinate
)

func (*ContinuousPickup) Parse

func (p *ContinuousPickup) Parse(text string) error

func (ContinuousPickup) String

func (p ContinuousPickup) String() string

func (ContinuousPickup) Validate

func (p ContinuousPickup) Validate() error

type Currency

type Currency = decimal.Decimal

type CurrencyCode

type CurrencyCode string

func (*CurrencyCode) Validate

func (c *CurrencyCode) Validate() error

type Date

type Date uint16

Date stores the number of days since Jan 1, 1970. The last representable date is June 6, 2149.

func NewFromDate

func NewFromDate(year int, month time.Month, day int) (Date, error)

NewFromDate returns a Date value corresponding to the supplied year, month, and day.

func NewFromTime

func NewFromTime(t time.Time) (Date, error)

NewFromTime returns a Date equivalent to NewFromDate(t.Date()), where t is a time.Time object.

func NewFromUnix

func NewFromUnix(seconds int64) (d Date, err error)

NewFromUnix creates a Date from a Unix timestamp, relative to any location Specifically, if you pass in t.Unix(), where t is a time.Time value with a non-UTC zone, you may receive an unexpected Date. Unless this behavior is specifically desired (returning the date in one location at the given time instant in another location), it's best to use epochdate.NewFromTime(t), which normalizes the resulting Date value by adjusting for zone offsets.

func Parse

func Parse(layout, value string) (d Date, err error)

Parse follows the same semantics as time.Parse, but ignores time-of-day information and returns a Date value.

func Today

func Today() Date

Today returns the local date at this instant. If the local date does not fall within the representable range, then then zero value will be returned (1970-01-01).

func TodayUTC

func TodayUTC() Date

TodayUTC returns the date at this instant, relative to UTC. If the UTC date does not fall within the representable range, then then zero value will be returned (1970-01-01).

func (Date) Date

func (d Date) Date() (year int, month time.Month, day int)

Date is semantically identical to the behavior of t.Date(), where t is a time.Time value.

func (Date) Format

func (d Date) Format(layout string) string

Format is identical to time.Time.Format, except that any time-of-day format specifiers that are used will be equivalent to "00:00:00Z".

func (Date) In

func (d Date) In(loc *time.Location) time.Time

In returns a location-relative Time object set to 00:00:00 on the given date.

func (Date) IsSet

func (d Date) IsSet() bool

func (Date) Local

func (d Date) Local() time.Time

Local returns a local Time object set to 00:00:00 on the given date.

func (Date) MarshalText

func (d Date) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Date) Parse

func (d *Date) Parse(data string) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Date) String

func (d Date) String() string

Returns an RFC3339/ISO-8601 date string, of the form "2006-01-02".

func (Date) UTC

func (d Date) UTC() time.Time

UTC returns a UTC Time object set to 00:00:00 on the given date.

func (Date) Unix

func (d Date) Unix() int64

Unix returns the number of seconds elapsed since Jan 1 1970 UTC, from the start of the given date value. In this case, the date is considered to be a UTC date, rather than a location-independent date.

func (Date) UnixNano

func (d Date) UnixNano() int64

UnixNano is semantically identical to the Unix method, except that it returns elapsed nanoseconds.

type DefaultService

type DefaultService struct {
	Monday    bool // Required	Indicates whether the service operates on all Mondays in the date range specified by the start_date and end_date fields. Note that exceptions for particular dates may be listed in calendar_dates.txt. Valid options are:
	Tuesday   bool // Required	Functions in the same way as monday except applies to Tuesdays
	Wednesday bool // Required	Functions in the same way as monday except applies to Wednesdays
	Thursday  bool // Required	Functions in the same way as monday except applies to Thursdays
	Friday    bool // Required	Functions in the same way as monday except applies to Fridays
	Saturday  bool // Required	Functions in the same way as monday except applies to Saturdays.
	Sunday    bool // Required	Functions in the same way as monday except applies to Sundays.
	StartDate Date // Required	Start service day for the service interval.
	EndDate   Date // Required	End service day for the service interval. This service day is included in the interval.
}

func (*DefaultService) Validate

func (ds *DefaultService) Validate(opts ...ValidationOpts) error

type Direction

type Direction int8
const (
	DirectionNone Direction = iota - 1
	DirectionOutbound
	DirectionInbound
)

func (*Direction) Parse

func (d *Direction) Parse(text string) error

func (Direction) String

func (d Direction) String() string

func (Direction) Validate

func (d Direction) Validate() error

type DropOff

type DropOff int8
const (
	DropOffTypeRegular DropOff = iota
	DropOffTypeNo
	DropOffTypeMustPhone
	DropOffTypeMustCoordinate
)

func (*DropOff) Parse

func (p *DropOff) Parse(text string) error

func (DropOff) String

func (p DropOff) String() string

func (DropOff) Validate

func (p DropOff) Validate() error

type DurationLimitType

type DurationLimitType int
const (
	DurationLimitTypeUnset DurationLimitType = iota - 1
	DurationLimitTypeDepartureArrival
	DurationLimitTypeDepartureDeparture
	DurationLimitTypeArrivalDeparture
	DurationLimitTypeArrivalArrival
)

func (*DurationLimitType) Parse

func (dlt *DurationLimitType) Parse(text string) error

func (DurationLimitType) String

func (dlt DurationLimitType) String() string

func (DurationLimitType) Validate

func (dlt DurationLimitType) Validate() error

type EntityErrors

type EntityErrors []error

func (*EntityErrors) Add

func (r *EntityErrors) Add(err error)

func (EntityErrors) Error

func (r EntityErrors) Error() string

func (EntityErrors) Unwrap

func (r EntityErrors) Unwrap() []error

type EntityFilter

type EntityFilter struct {
	SkipShapes       bool
	SkipFares        bool
	SkipAttributions bool
	SkipTranslations bool
	SkipFaresv2      bool
}

type EntitySetErrors

type EntitySetErrors map[string]EntityErrors

func (EntitySetErrors) Error

func (r EntitySetErrors) Error() string

func (*EntitySetErrors) Set

func (r *EntitySetErrors) Set(id string, err EntityErrors)

func (EntitySetErrors) Unwrap

func (r EntitySetErrors) Unwrap() []error

type ExactTimes

type ExactTimes bool

func (*ExactTimes) Parse

func (et *ExactTimes) Parse(text string) error

func (ExactTimes) String

func (et ExactTimes) String() string

type FareAttribute

type FareAttribute struct {
	Price            Currency      //Required	Fare price, in the unit specified by currency_type.
	CurrencyType     string        //Required	Currency used to pay the fare.
	PaymentMethod    PaymentMethod //Required	Indicates when the fare must be paid. Valid options are:
	Transfers        TransferLimit //Required	Indicates the number of transfers permitted on this fare. Valid options are:
	AgencyID         string        //Conditionally Required	Identifies the relevant agency for a fare.
	TransferDuration int           //Optional	Length of time in seconds before a transfer expires. When transfers=0 this field may be used to indicate how long a ticket is valid for or it may be left empty.
	// contains filtered or unexported fields
}

func (*FareAttribute) Agency

func (a *FareAttribute) Agency() *Agency

func (*FareAttribute) ID

func (fe *FareAttribute) ID() string

func (*FareAttribute) SetAdditionalField

func (fe *FareAttribute) SetAdditionalField(k, v string)

func (*FareAttribute) Validate

func (a *FareAttribute) Validate(opts ...ValidationOpts) error

type FareAttributes

type FareAttributes map[string]*FareAttribute

func (*FareAttributes) Validate

func (a *FareAttributes) Validate(opts ...ValidationOpts) error

type FareLegRule

type FareLegRule struct {
	LegGroupID           string // Optional Identifies a group of entries in fare_leg_rules.txt.
	NetworkID            string // Optional Identifies a route network that applies for the fare leg rule.
	FromAreaID           string // Optional Identifies a departure area.
	ToAreaID             string // Optional Identifies an arrival area.
	FromTimeframeGroupID string // Optional Defines the timeframe for the fare validation event at the start of the fare leg.
	ToTimeframeGroupID   string // Optional Defines the timeframe for the fare validation event at the end of the fare leg.
	FareProductID        string // Required The fare product required to travel the leg.
	// contains filtered or unexported fields
}

func (*FareLegRule) ID

func (f *FareLegRule) ID() string

func (*FareLegRule) SetAdditionalField

func (fe *FareLegRule) SetAdditionalField(k, v string)

func (*FareLegRule) Validate

func (f *FareLegRule) Validate(opts ...ValidationOpts) error

type FareLegRules

type FareLegRules map[string]*FareLegRule

func (*FareLegRules) Validate

func (f *FareLegRules) Validate(opts ...ValidationOpts) error

type FareMedia

type FareMedia struct {
	Name string        //Optional	Name of the fare media.
	Type FareMediaType //Required	The type of fare media. Valid options are:
	// contains filtered or unexported fields
}

func (*FareMedia) ID

func (fe *FareMedia) ID() string

func (*FareMedia) SetAdditionalField

func (fe *FareMedia) SetAdditionalField(k, v string)

func (*FareMedia) Validate

func (fm *FareMedia) Validate(opts ...ValidationOpts) error

type FareMediaType

type FareMediaType int8
const (
	FareMediaTypeNone FareMediaType = iota
	FareMediaTypePaperTicket
	FareMediaTypeTransitCard
	FareMediaTypeCEMV
	FareMediaTypeMobileApp
)

func (*FareMediaType) Parse

func (fmt *FareMediaType) Parse(text string) error

func (FareMediaType) String

func (fmt FareMediaType) String() string

func (FareMediaType) Validate

func (fmt FareMediaType) Validate() error

type FareMedias

type FareMedias map[string]*FareMedia

func (*FareMedias) Validate

func (fm *FareMedias) Validate(opts ...ValidationOpts) error

type FareProduct

type FareProduct struct {
	Name      string       //Optional	The name of the fare product as displayed to riders.
	ProductID string       //Required	Identifies a fare product.
	MediaID   string       //Optional	Identifies a fare media that can be employed to use the fare product during the trip. When fare_media_id is empty, it is considered that the fare media is unknown.
	Amount    Currency     //Required	The cost of the fare product. May be negative to represent transfer discounts. May be zero to represent a fare product that is free.
	Currency  CurrencyCode //Required	The currency of the cost of the fare product.
	// contains filtered or unexported fields
}

func (*FareProduct) FareMedia

func (fp *FareProduct) FareMedia() *FareMedia

func (*FareProduct) ID

func (fp *FareProduct) ID() string

func (*FareProduct) SetAdditionalField

func (fe *FareProduct) SetAdditionalField(k, v string)

func (*FareProduct) Validate

func (fp *FareProduct) Validate(opts ...ValidationOpts) error

type FareProducts

type FareProducts map[string]*FareProduct

func (*FareProducts) Validate

func (fp *FareProducts) Validate(opts ...ValidationOpts) error

type FareRule

type FareRule struct {
	FareID        string //Required	Identifies a fare class.
	RouteID       string //Optional	Identifies a route associated with the fare class. If several routes with the same fare attributes exist, create a record in fare_rules.txt for each route.
	OriginID      string //Optional	Identifies an origin zone. If a fare class has multiple origin zones, create a record in fare_rules.txt for each origin_id.
	DestinationID string //Optional	Identifies a destination zone. If a fare class has multiple destination zones, create a record in fare_rules.txt for each destination_id.
	ContainsID    string //Optional	Identifies the zones that a rider will enter while using a given fare class. Used in some systems to calculate correct fare class.
	// contains filtered or unexported fields
}

func (*FareRule) Fare

func (fr *FareRule) Fare() *Route

func (*FareRule) ID

func (fr *FareRule) ID() string

func (*FareRule) Route

func (fr *FareRule) Route() *Route

func (*FareRule) SetAdditionalField

func (fe *FareRule) SetAdditionalField(k, v string)

func (*FareRule) Validate

func (fr *FareRule) Validate(opts ...ValidationOpts) error

type FareRules

type FareRules map[string]*FareRule

func (*FareRules) Validate

func (fr *FareRules) Validate(opts ...ValidationOpts) error

type FareTransferRule

type FareTransferRule struct {
	FromLegGroupID    string            //Optional - Foreign ID referencing fare_leg_rules.leg_group_id
	ToLegGroupID      string            //Optional - Foreign ID referencing fare_leg_rules.leg_group_id
	TransferCount     int               //Conditionally Forbidden - Non-zero integer
	DurationLimit     int               //Optional - Positive integer
	DurationLimitType DurationLimitType //Conditionally Required - Enum
	FareTransferType  FareTransferType  //Required - Enum
	FareProductID     string            //Optional - Foreign ID referencing fare_products.fare_product_id
	// contains filtered or unexported fields
}

func (*FareTransferRule) ID

func (ftr *FareTransferRule) ID() string

ID built from from_leg_group_id, to_leg_group_id, fare_product_id, transfer_count, duration_limit

func (*FareTransferRule) SetAdditionalField

func (fe *FareTransferRule) SetAdditionalField(k, v string)

func (*FareTransferRule) Validate

func (ftr *FareTransferRule) Validate(opts ...ValidationOpts) error

type FareTransferRules

type FareTransferRules map[string]*FareTransferRule

func (*FareTransferRules) Validate

func (ftr *FareTransferRules) Validate(opts ...ValidationOpts) error

type FareTransferType

type FareTransferType int

see https://org/schedule/reference/#fare_transfer_rulestxt

const (
	FareTransferTypeAplusAB FareTransferType = iota
	FareTransferTypeAplusABplusB
	FareTransferTypeAB
)

func (*FareTransferType) Parse

func (ftt *FareTransferType) Parse(text string) error

func (FareTransferType) String

func (ftt FareTransferType) String() string

func (FareTransferType) Validate

func (ftt FareTransferType) Validate() error

type Feed

type Feed struct {
	Agencies          Agencies
	Attributions      Attributions
	Areas             Areas
	Stops             Stops
	Routes            Routes
	Trips             Trips
	Levels            Levels
	Shapes            Shapes
	Services          Services
	Patterns          Patterns
	Pathways          Pathways
	Networks          Networks
	FareAttributes    FareAttributes
	FareRules         FareRules
	FareTransferRules FareTransferRules
	FareMedias        FareMedias
	FareProducts      FareProducts
	FareLegRules      FareLegRules
	Transfers         Transfers
	Timeframes        Timeframes
	Translations      Translations
	FeedInfo          *FeedInfo
}

func NewFeed

func NewFeed() *Feed

func Read

func Read(sp ReadStreamProvider, readerOpts ...ReadOpts) (*Feed, error)

func ReadGOBFile

func ReadGOBFile(path string) (*Feed, error)

func ReadGOBStream

func ReadGOBStream(r io.Reader) (*Feed, error)

func ReadTxtarFile

func ReadTxtarFile(filename string) (*Feed, error)

ReadTxtarFile reads a feed from a txtar file. Useful in unit tests.

func ReadZipFile

func ReadZipFile(path string, readerOpts ...ReadOpts) (*Feed, error)

func ReadZipReader

func ReadZipReader(zr *zip.Reader, readerOpts ...ReadOpts) (*Feed, error)

func (*Feed) SetAgency

func (f *Feed) SetAgency(id string, agency *Agency, opts ...Opts) (*Agency, error)

func (*Feed) SetArea

func (f *Feed) SetArea(id string, area *Area, opts ...Opts) (*Area, error)

func (*Feed) SetAttribution

func (f *Feed) SetAttribution(id string, area *Attribution, opts ...Opts) (*Attribution, error)

func (*Feed) SetFareAttribute

func (f *Feed) SetFareAttribute(id string, fareAttribute *FareAttribute, opts ...Opts) (*FareAttribute, error)

func (*Feed) SetFareLegRule

func (f *Feed) SetFareLegRule(id string, fareLegRule *FareLegRule, opts ...Opts) (*FareLegRule, error)

func (*Feed) SetFareMedia

func (f *Feed) SetFareMedia(id string, fareMedia *FareMedia, opts ...Opts) (*FareMedia, error)

func (*Feed) SetFareProduct

func (f *Feed) SetFareProduct(id string, fareProduct *FareProduct, opts ...Opts) (*FareProduct, error)

func (*Feed) SetFareRule

func (f *Feed) SetFareRule(id string, fareRule *FareRule, opts ...Opts) (*FareRule, error)

func (*Feed) SetFareTransferRule

func (f *Feed) SetFareTransferRule(id string, fareTransferRule *FareTransferRule, opts ...Opts) (*FareTransferRule, error)

func (*Feed) SetLevel

func (f *Feed) SetLevel(id string, level *Level, opts ...Opts) (*Level, error)

func (*Feed) SetNetwork

func (f *Feed) SetNetwork(id string, network *Network, opts ...Opts) (*Network, error)

func (*Feed) SetPathway

func (f *Feed) SetPathway(id string, pathway *Pathway, opts ...Opts) (*Pathway, error)

func (*Feed) SetRoute

func (f *Feed) SetRoute(id string, route *Route, opts ...Opts) (*Route, error)

func (*Feed) SetService

func (f *Feed) SetService(id string, service *Service, opts ...Opts) (*Service, error)

func (*Feed) SetShape

func (f *Feed) SetShape(id string, shape *Shape, opts ...Opts) (*Shape, error)

func (*Feed) SetStop

func (f *Feed) SetStop(id string, stop *Stop, opts ...Opts) (*Stop, error)

func (*Feed) SetTimeframe

func (f *Feed) SetTimeframe(id string, timeframe *Timeframe, opts ...Opts) (*Timeframe, error)

func (*Feed) SetTransfer

func (f *Feed) SetTransfer(id string, transfer *Transfer, opts ...Opts) (*Transfer, error)

func (*Feed) SetTranslation

func (f *Feed) SetTranslation(id string, translation *Translation, opts ...Opts) (*Translation, error)

func (*Feed) SetTrip

func (f *Feed) SetTrip(id string, trip *Trip, opts ...Opts) (*Trip, error)

func (*Feed) Validate

func (f *Feed) Validate(opts ...ValidationOpts) error

type FeedErrors

type FeedErrors map[string]EntitySetErrors

func (FeedErrors) Error

func (r FeedErrors) Error() string

func (*FeedErrors) Set

func (r *FeedErrors) Set(id string, err EntitySetErrors)

type FeedInfo

type FeedInfo struct {
	PublisherName string // Required. Full name of the organization that publishes the dataset. This may be the same as one of the agency.agency_name values.
	PublisherURL  string // Required. URL of the dataset publishing organization's website. This may be the same as one of the agency.agency_url values.
	Lang          string // Required. Default language used for the text in this dataset. This setting helps GTFS consumers choose capitalization rules and other language-specific settings for the dataset. The file translations.txt can be used if the text needs to be translated into languages other than the default one.
	DefaultLang   string // Optional. Defines the language that should be used when the data consumer doesn’t know the language of the rider. It will often be en (English).
	StartDate     Date   // Recommended. The dataset provides complete and reliable schedule information for service in the period from the beginning of the feed_start_date day to the end of the feed_end_date day. Both days may be left empty if unavailable. The feed_end_date date must not precede the feed_start_date date if both are given. It is recommended that dataset providers give schedule data outside this period to advise of likely future service, but dataset consumers should treat it mindful of its non-authoritative status. If feed_start_date or feed_end_date extend beyond the active calendar dates defined in calendar.txt and calendar_dates.txt, the dataset is making an explicit assertion that there is no service for dates within the feed_start_date or feed_end_date range but not included in the active calendar dates.
	EndDate       Date   // Recommended. (see above)
	Version       string // Recommended. String that indicates the current version of their GTFS dataset. GTFS-consuming applications can display this value to help dataset publishers determine whether the latest dataset has been incorporated.
	ContactEmail  string // Optional. Email address for communication regarding the GTFS dataset and data publishing practices. feed_contact_email is a technical contact for GTFS-consuming applications. Provide customer service contact information through agency.txt. It's recommended that at least one of feed_contact_email or feed_contact_url are provided.
	ContactURL    string // Optional. URL for contact information, a web-form, support desk, or other tools for communication regarding the GTFS dataset and data publishing practices. feed_contact_url is a technical contact for GTFS-consuming applications. Provide customer service contact information through agency.txt. It's recommended that at least one of feed_contact_url or feed_contact_email are provided.
}

func (*FeedInfo) Validate

func (f *FeedInfo) Validate(opts ...ValidationOpts) error

type Frequencies

type Frequencies []Frequency

func (*Frequencies) Validate

func (f *Frequencies) Validate() error

type Frequency

type Frequency struct {
	StartTime   Time
	EndTime     Time
	HeadwaySecs int
	ExactTimes  ExactTimes
}

func (*Frequency) Validate

func (f *Frequency) Validate() error

type Level

type Level struct {
	Index float64
	Name  string
	// contains filtered or unexported fields
}

func (*Level) ID

func (fe *Level) ID() string

func (*Level) SetAdditionalField

func (fe *Level) SetAdditionalField(k, v string)

func (*Level) Validate

func (l *Level) Validate(opts ...ValidationOpts) error

type Levels

type Levels map[string]*Level

func (*Levels) Validate

func (l *Levels) Validate(opts ...ValidationOpts) error

type Location

type Location uint8
const (
	LocationTypeStop Location = iota
	LocationTypeStation
	LocationTypeEntranceExit
	LocationTypeGenericNode
	LocationTypeBoardingArea
)

func (*Location) Parse

func (lt *Location) Parse(text string) error

func (Location) String

func (lt Location) String() string

func (Location) Validate

func (lt Location) Validate() error

type Network

type Network struct {
	Name string // Optional
	// contains filtered or unexported fields
}

func (*Network) ID

func (fe *Network) ID() string

func (*Network) Routes

func (n *Network) Routes() []*Route

func (*Network) SetAdditionalField

func (fe *Network) SetAdditionalField(k, v string)

func (*Network) Validate

func (n *Network) Validate(opts ...ValidationOpts) error

type Networks

type Networks map[string]*Network

func (*Networks) Validate

func (n *Networks) Validate(opts ...ValidationOpts) error

type Opts

type Opts func(*setOpts)

func WithConflictBehaviour

func WithConflictBehaviour(conflictBehaviour ConflictBehaviour) Opts

type Pathway

type Pathway struct {
	FromStopID           string               // Required
	ToStopID             string               // Required
	PathwayMode          PathwayMode          // Required
	IsBidirectional      PathwayBidirectional // Required
	Length               float64              // Optional
	TraversalTime        int                  // Optional
	StairCount           int                  // Optional
	MaxSlope             float64              // Optional
	MinWidth             float64              // Optional
	SignpostedAs         string               // Optional
	ReversedSignpostedAs string               // Optional
	// contains filtered or unexported fields
}

func (*Pathway) FromStop

func (p *Pathway) FromStop() *Stop

func (*Pathway) ID

func (fe *Pathway) ID() string

func (*Pathway) SetAdditionalField

func (fe *Pathway) SetAdditionalField(k, v string)

func (*Pathway) ToStop

func (p *Pathway) ToStop() *Stop

func (*Pathway) Validate

func (p *Pathway) Validate(opts ...ValidationOpts) error

type PathwayBidirectional

type PathwayBidirectional bool

func (*PathwayBidirectional) Parse

func (p *PathwayBidirectional) Parse(text string) error

func (PathwayBidirectional) String

func (p PathwayBidirectional) String() string

type PathwayMode

type PathwayMode int
const (
	PathwayModeWalkway PathwayMode = iota + 1
	PathwayModeStairs
	PathwayModeMovingSidewalk
	PathwayModeEscalator
	PathwayModeElevator
	PathwayModeFareGate
	PathwayModeExitGate
)

func (*PathwayMode) Parse

func (p *PathwayMode) Parse(text string) error

func (PathwayMode) String

func (p PathwayMode) String() string

func (PathwayMode) Validate

func (p PathwayMode) Validate() error

type Pathways

type Pathways map[string]*Pathway

func (*Pathways) Validate

func (p *Pathways) Validate(opts ...ValidationOpts) error

type Pattern

type Pattern []RelativeStopTime

func (*Pattern) ID

func (p *Pattern) ID() string

func (*Pattern) Validate

func (p *Pattern) Validate(opts ...ValidationOpts) error

type Patterns

type Patterns map[string]Pattern

func (*Patterns) Validate

func (p *Patterns) Validate(opts ...ValidationOpts) error

type PaymentMethod

type PaymentMethod int
const (
	PaymentMethodOnBoard PaymentMethod = iota
	PaymentMethodBeforeBoarding
)

func (*PaymentMethod) Parse

func (m *PaymentMethod) Parse(text string) error

func (PaymentMethod) String

func (m PaymentMethod) String() string

func (PaymentMethod) Validate

func (m PaymentMethod) Validate() error

type Pickup

type Pickup int8
const (
	PickupTypeRegular Pickup = iota
	PickupTypeNo
	PickupTypeMustPhone
	PickupTypeMustCoordinate
)

func (*Pickup) Parse

func (p *Pickup) Parse(text string) error

func (Pickup) String

func (p Pickup) String() string

func (Pickup) Validate

func (p Pickup) Validate() error

type Point

type Point struct {
	Lat              float64
	Lon              float64
	DistanceTraveled float64
	Sequence         int
}

func (*Point) Validate

func (p *Point) Validate() error

type ReadOpts

type ReadOpts func(*csvReader)

func ContinueOnRecordError

func ContinueOnRecordError() ReadOpts

func IncludeUnreferenced

func IncludeUnreferenced() ReadOpts

IncludeUnreferenced includes records that are not referenced by any route or trip

func WithEntityFilter

func WithEntityFilter(ef EntityFilter) ReadOpts

func WithErrorCollector

func WithErrorCollector(ec func(e error)) ReadOpts

func WithLogger

func WithLogger(logger *slog.Logger) ReadOpts

func WithModeFilter

func WithModeFilter(modes ...RouteType) ReadOpts

func WithOptimseServices

func WithOptimseServices(v bool) ReadOpts

func WithOptimseShapes

func WithOptimseShapes(v bool) ReadOpts

type ReadStreamProvider

type ReadStreamProvider interface {
	ReadStream(filename string) (io.ReadCloser, error)
}

type RelativeStopTime

type RelativeStopTime struct {
	ArrivalTimeOffset   Time
	DepartureTimeOffset Time
	StopTime
}

func (*RelativeStopTime) ID

func (fe *RelativeStopTime) ID() string

func (*RelativeStopTime) SetAdditionalField

func (fe *RelativeStopTime) SetAdditionalField(k, v string)

func (*RelativeStopTime) Validate

func (rst *RelativeStopTime) Validate() error

type RelativeStopTimes

type RelativeStopTimes struct {
	ArrivalTime Time //the absolute start time of the trip
	StopTimes   []RelativeStopTime
}

type Route

type Route struct {
	ShortName         string            // Conditionally Required	Short name of a route. Often a short, abstract identifier (e.g., "32", "100X", "Green") that riders use to identify a route. Both route_short_name and route_long_name may be defined.
	LongName          string            // Conditionally Required	Full name of a route. This name is generally more descriptive than the route_short_name and often includes the route's destination or stop. Both route_short_name and route_long_name may be defined.
	Desc              string            // Optional	Description of a route that provides useful, quality information. Should not be a duplicate of route_short_name or route_long_name.
	Type              RouteType         // Required	Indicates the type of transportation used on a route. Valid options are: 1
	URL               string            // Optional	URL of a web page about the particular route. Should be different from the agency.agency_url value.
	Color             Color             // Optional	Route color designation that matches public facing material. Defaults to white (FFFFFF) when omitted or left empty. The color difference between route_color and route_text_color should provide sufficient contrast when viewed on a black and white screen.
	TextColor         Color             // Optional	Legible color to use for text drawn against a background of route_color. Defaults to black (000000) when omitted or left empty. The color difference between route_color and route_text_color should provide sufficient contrast when viewed on a black and white screen.
	SortOrder         uint              // Optional	Orders the routes in a way which is ideal for presentation to customers. Routes with smaller route_sort_order values should be displayed first.
	ContinuousPickup  ContinuousPickup  // Optional	Indicates that the rider can board the transit vehicle at any point along the vehicle’s travel path as described by shapes.txt, on every trip of the route.
	ContinuousDropOff ContinuousDropOff // Optional	Indicates that the rider can alight from the transit vehicle at any point along the vehicle’s travel path as described by shapes.txt, on every trip of the route.
	NetworkID         string            // Optional	Identifies a group of routes. Multiple rows in routes.txt may have the same network_id.
	NetworkIDs        []string
	AgencyID          string // Optional
	// contains filtered or unexported fields
}

func (*Route) Agency

func (r *Route) Agency() *Agency

func (*Route) ID

func (fe *Route) ID() string

func (*Route) Networks

func (r *Route) Networks() []*Network

func (*Route) SetAdditionalField

func (fe *Route) SetAdditionalField(k, v string)

func (*Route) Trips

func (r *Route) Trips() []*Trip

func (*Route) Validate

func (r *Route) Validate(opts ...ValidationOpts) error

type RouteType

type RouteType int

func (*RouteType) Parse

func (m *RouteType) Parse(text string) error

func (RouteType) String

func (m RouteType) String() string

func (RouteType) Validate

func (m RouteType) Validate() error

type Routes

type Routes map[string]*Route

func (*Routes) Validate

func (r *Routes) Validate(opts ...ValidationOpts) error

type Service

type Service struct {
	DefaultService *DefaultService
	Exceptions     []ServiceException
	// contains filtered or unexported fields
}

func (*Service) Copy

func (s *Service) Copy() *Service

func (*Service) Hash

func (s *Service) Hash() string

func (*Service) ID

func (fe *Service) ID() string

func (*Service) IsActiveOn

func (s *Service) IsActiveOn(date Date) bool

func (*Service) SetAdditionalField

func (fe *Service) SetAdditionalField(k, v string)

func (*Service) SetID

func (s *Service) SetID(id string, opts ...Opts) error

func (*Service) Validate

func (s *Service) Validate(opts ...ValidationOpts) error

type ServiceException

type ServiceException struct {
	Date          Date // Required	The date field specifies a particular date when service availability is different than the norm. You can use the exception_type field to indicate whether service is available on the specified date.
	ExceptionType ServiceExceptionType
}

func (*ServiceException) Validate

func (se *ServiceException) Validate(opts ...ValidationOpts) error

type ServiceExceptionType

type ServiceExceptionType uint8
const (
	ServiceExceptionAdded ServiceExceptionType = iota + 1
	ServiceExceptionRemoved
)

func (*ServiceExceptionType) Parse

func (s *ServiceExceptionType) Parse(text string) error

func (ServiceExceptionType) String

func (s ServiceExceptionType) String() string

func (ServiceExceptionType) Validate

func (s ServiceExceptionType) Validate() error

type Services

type Services map[string]*Service

func (*Services) Validate

func (s *Services) Validate(opts ...ValidationOpts) error

type Shape

type Shape struct {
	Points []Point
	// contains filtered or unexported fields
}

func (*Shape) Hash

func (s *Shape) Hash() string

func (*Shape) ID

func (fe *Shape) ID() string

func (*Shape) SetAdditionalField

func (fe *Shape) SetAdditionalField(k, v string)

func (*Shape) SetID

func (s *Shape) SetID(id string, opts ...Opts) error

func (*Shape) SetPoints

func (s *Shape) SetPoints(p []Point) error

func (*Shape) Validate

func (s *Shape) Validate(opts ...ValidationOpts) error

type Shapes

type Shapes map[string]*Shape

func (Shapes) Validate

func (s Shapes) Validate(opts ...ValidationOpts) error

type Stop

type Stop struct {
	Code               string                // Optional. Short text or a number that identifies the location for riders. These codes are often used in phone-based transit information systems or printed on signage to make it easier for riders to get information for a particular location. The stop_code may be the same as stop_id if it is public facing. This field should be left empty for locations without a code presented to riders.
	Name               string                // Required. Name of the location. The stop_name should match the name of the location displayed to riders. For translations into other languages, use translations.txt.
	TTSName            string                // Optional. Readable version of the stop_name. See "Text-to-speech field" in the Term Definitions for more.
	Desc               string                // Optional. Description of the location that provides useful, quality information. Should not be a duplicate of stop_name.
	Lat                *float64              // Required. Latitude of the location.
	Lon                *float64              // Required. Longitude of the location.
	ZoneID             string                // Optional. Identifies the fare zone for a stop. If this record represents a station or station entrance, the zone_id is ignored.
	URL                string                // Optional. URL of a web page about the location. This should be different from the agency.agency_url and the routes.route_url field values.
	LocationType       Location              // Optional. Location type. Valid options are:
	ParentStationID    string                // Optional. Defines hierarchy between the different locations defined in stops.txt. It contains the ID of the parent location, as followed:
	Timezone           string                // Optional. Timezone of the location. If the location has a parent station, it inherits the parent station’s timezone instead of applying its own. Stations and parentless stops with empty stop_timezone inherit the timezone specified by agency.agency_timezone. If stop_timezone values are provided, the times in stop_times.txt should be entered as the time since midnight in the timezone specified by agency.agency_timezone. This ensures that the time values in a trip always increase over the course of a trip, regardless of which timezones the trip crosses.
	WheelchairBoarding WheelchairInformation // Optional. Indicates whether wheelchair boardings are possible from the location. Valid options are:
	LevelID            string                // Optional. Level of the location. The same level may be used by multiple unlinked stations.
	PlatformCode       string                // Optional. Platform identifier for a platform stop (a stop belonging to a station). This should be just the platform identifier (eg. "G" or "3"). Words like “platform” or "track" (or the feed’s language-specific equivalent) should not be included. This allows feed consumers to more easily internationalize and localize the platform identifier into other languages.
	AreaIDs            []string              // Optional. List of child locations id's which belong to this location. A child location may belong to multiple parent locations.
	// contains filtered or unexported fields
}

func (*Stop) Areas

func (s *Stop) Areas() []*Area

func (*Stop) ID

func (fe *Stop) ID() string

func (*Stop) LevelD

func (s *Stop) LevelD() *Level

func (*Stop) ParentStation

func (s *Stop) ParentStation() *Stop

func (*Stop) SetAdditionalField

func (fe *Stop) SetAdditionalField(k, v string)

func (*Stop) Validate

func (s *Stop) Validate(opts ...ValidationOpts) error

type StopTime

type StopTime struct {
	StopSequence      int
	StopID            string
	TripID            string
	StopHeadsign      string
	PickupType        Pickup
	DropoffType       DropOff
	ContinuousPickup  ContinuousPickup
	ContinuousDropoff ContinuousDropOff
	ShapeDistTraveled float64
	Timepoint         TimingPoint
	// contains filtered or unexported fields
}

func (*StopTime) ID

func (fe *StopTime) ID() string

func (*StopTime) SetAdditionalField

func (fe *StopTime) SetAdditionalField(k, v string)

func (*StopTime) Stop

func (st *StopTime) Stop() *Stop

func (*StopTime) Trip

func (st *StopTime) Trip() *Trip

func (*StopTime) Validate

func (st *StopTime) Validate() error

type Stops

type Stops map[string]*Stop

func (*Stops) Validate

func (s *Stops) Validate(opts ...ValidationOpts) error

type Time

type Time struct {
	SecondsSinceMidnight uint32
	IsSet                bool
}

func NewTime

func NewTime(hours, minutes, seconds int) Time

func ParseTime

func ParseTime(time string) (Time, error)

func (*Time) Clear

func (t *Time) Clear()

func (Time) Hours

func (t Time) Hours() int

Hours returns hours element of the current time.

func (Time) MarshalText

func (t Time) MarshalText() ([]byte, error)

func (Time) Minutes

func (t Time) Minutes() int

Minutes returns minutes element of the current time.

func (*Time) Parse

func (t *Time) Parse(text string) error

Time in the HH:MM:SS format (H:MM:SS is also accepted).

func (Time) Seconds

func (t Time) Seconds() int

Seconds returns seconds element of the current time.

func (Time) String

func (t Time) String() string

type Timeframe

type Timeframe struct {
	GroupID   string //Required	Identifies a timeframe or set of timeframes.
	StartTime Time   //Conditionally Required	Defines the beginning of a timeframe. The interval includes the start time.
	EndTime   Time   //Conditionally Required	Defines the end of a timeframe. The interval does not include the end time.
	ServiceID string //Required	Identifies a set of dates that a timeframe is in effect.
	// contains filtered or unexported fields
}

func (*Timeframe) ID

func (tf *Timeframe) ID() string

func (*Timeframe) Service

func (tf *Timeframe) Service() *Service

func (*Timeframe) SetAdditionalField

func (fe *Timeframe) SetAdditionalField(k, v string)

func (*Timeframe) Validate

func (tf *Timeframe) Validate(opts ...ValidationOpts) error

type Timeframes

type Timeframes map[string]*Timeframe

func (*Timeframes) Validate

func (tf *Timeframes) Validate(opts ...ValidationOpts) error

type TimingPoint

type TimingPoint bool

func (*TimingPoint) Parse

func (tp *TimingPoint) Parse(text string) error

func (TimingPoint) String

func (tp TimingPoint) String() string

type Transfer

type Transfer struct {
	FromStopID      string       // Conditionally Required
	ToStopID        string       // Conditionally Required
	FromRouteID     string       // Optional
	ToRouteID       string       // Optional
	FromTripID      string       // Conditionally Required
	ToTripID        string       // Conditionally Required
	TransferType    TransferType // Required
	MinTransferTime int          // Optional
	// contains filtered or unexported fields
}

func (*Transfer) FromRoute

func (t *Transfer) FromRoute() *Route

func (*Transfer) FromStop

func (t *Transfer) FromStop() *Stop

func (*Transfer) FromTrip

func (t *Transfer) FromTrip() *Trip

func (*Transfer) ID

func (t *Transfer) ID() string

func (*Transfer) SetAdditionalField

func (fe *Transfer) SetAdditionalField(k, v string)

func (*Transfer) ToRoute

func (t *Transfer) ToRoute() *Route

func (*Transfer) ToStop

func (t *Transfer) ToStop() *Stop

func (*Transfer) ToTrip

func (t *Transfer) ToTrip() *Trip

func (*Transfer) Validate

func (t *Transfer) Validate(opts ...ValidationOpts) error

type TransferLimit

type TransferLimit int
const (
	TransferLimitUnlimited TransferLimit = iota - 1
	TransferLimitNone
	TransferLimitOnce
	TransferLimitTwice
)

func (*TransferLimit) Parse

func (tl *TransferLimit) Parse(text string) error

func (TransferLimit) String

func (tl TransferLimit) String() string

func (TransferLimit) Validate

func (tl TransferLimit) Validate() error

type TransferType

type TransferType int
const (
	TransferTypeRecommendedTransferPoint TransferType = iota
	TransferTypeTimedTransferPoint
	TransferTypeMinimumTransferTime
	TransferTypeNoTransfers
	TransferTypeInSeatTransfer
	TransferTypeNoInSeatTransfer
)

func (*TransferType) Parse

func (p *TransferType) Parse(text string) error

func (TransferType) String

func (p TransferType) String() string

func (TransferType) Validate

func (p TransferType) Validate() error

type Transfers

type Transfers map[string]*Transfer

func (*Transfers) Validate

func (t *Transfers) Validate(opts ...ValidationOpts) error

type Translation

type Translation struct {
	TableName   TranslationTable // Required	Defines the table that contains the field to be translated. Allowed values are:
	FieldName   string           // Required	Name of the field to be translated. Fields with type Text may be translated, fields with type URL, Email and Phone number may also be “translated” to provide resources in the correct language. Fields with other types should not be translated.
	Language    string           // Required	Language of translation.
	Translation string           // Required	Translated value.
	RecordID    string           // Conditionally Required	Defines the record that corresponds to the field to be translated. The value in record_id must be the first or only field of a table's primary key, as defined in the primary key attribute for each table and below:
	RecordSubID string           // Conditionally Required	Helps the record that contains the field to be translated when the table doesn’t have a unique ID. Therefore, the value in record_sub_id is the secondary ID of the table, as defined by the table below:
	FieldValue  string           // Conditionally Required	Instead of defining which record should be translated by using record_id and record_sub_id, this field can be used to define the value which should be translated. When used, the translation will be applied when the fields identified by table_name and field_name contains the exact same value defined in field_value.
	// contains filtered or unexported fields
}

func (*Translation) ID

func (t *Translation) ID() string

func (*Translation) SetAdditionalField

func (fe *Translation) SetAdditionalField(k, v string)

func (*Translation) Validate

func (t *Translation) Validate(opts ...ValidationOpts) error

type TranslationTable

type TranslationTable string
const (
	TranslationTableAgency       TranslationTable = "agency"
	TranslationTableStops        TranslationTable = "stops"
	TranslationTableRoutes       TranslationTable = "routes"
	TranslationTableTrips        TranslationTable = "trips"
	TranslationTableStopTimes    TranslationTable = "stop_times"
	TranslationTablePathways     TranslationTable = "pathways"
	TranslationTableLevels       TranslationTable = "levels"
	TranslationTableFeedInfo     TranslationTable = "feed_info"
	TranslationTableAttributions TranslationTable = "attributions"
)

func (*TranslationTable) Parse

func (t *TranslationTable) Parse(in string) error

func (TranslationTable) Validate

func (t TranslationTable) Validate() error

type Translations

type Translations map[string]*Translation

func (*Translations) Validate

func (t *Translations) Validate(opts ...ValidationOpts) error

type Trip

type Trip struct {
	RouteID              string                // Required	Identifies a route.
	ServiceID            string                // Required	Identifies a set of dates when service is available for one or more routes.
	Headsign             string                // Optional	Text that appears on signage identifying the trip's destination to riders. Should be used to distinguish between different patterns of service on the same route.
	ShortName            string                // Optional	Public facing text used to identify the trip to riders, for instance, to identify train numbers for commuter rail trips. If riders do not commonly rely on trip names, trip_short_name should be empty. A trip_short_name value, if provided, should uniquely identify a trip within a service day; it should not be used for destination names or limited/express designations.
	Direction            Direction             // Optional	Indicates the direction of travel for a trip. This field should not be used in routing; it provides a way to separate trips by direction when publishing time tables. Valid options are:
	BlockID              string                // Optional	Identifies the block to which the trip belongs. A block consists of a single trip or many sequential trips made using the same vehicle, defined by shared service days and block_id. A block_id may have trips with different service days, making distinct blocks. See the example below. To provide in-seat transfers information, transfers of transfer_type 4 should be provided instead.
	ShapeID              string                // Conditionally Required	Identifies a geospatial shape describing the vehicle travel path for a trip.
	WheelchairAccessible WheelchairInformation // Optional	Indicates wheelchair accessibility. Valid options are:
	BikesAllowed         BikeInformation       // Optional	Indicates whether bikes are allowed. Valid options are:
	StartTime            Time                  // Additonal The time at which the vehicle begins its trip. this is needed due to the way we store stop times internally. It shouln't be set directly and is populted via SetRelativeStopTimes() or SetAbsoluteStopTimes()
	Frequencies          Frequencies
	PatternID            string
	// contains filtered or unexported fields
}

func (*Trip) AbsoluteStopTimes

func (t *Trip) AbsoluteStopTimes() AbsoluteStopTimes

func (*Trip) ID

func (fe *Trip) ID() string

func (*Trip) Pattern

func (t *Trip) Pattern() Pattern

should only be used by writers. to access trip stop times use AbsoluteStopTimes() or RelativeStopTimes()

func (*Trip) RelativeStopTimes

func (t *Trip) RelativeStopTimes() RelativeStopTimes

func (*Trip) Route

func (t *Trip) Route() *Route

func (*Trip) Service

func (t *Trip) Service() *Service

func (*Trip) SetAbsoluteStopTimes

func (t *Trip) SetAbsoluteStopTimes(ast AbsoluteStopTimes) error

func (*Trip) SetAdditionalField

func (fe *Trip) SetAdditionalField(k, v string)

func (*Trip) SetRelativeStopTimes

func (t *Trip) SetRelativeStopTimes(rst RelativeStopTimes) error

func (*Trip) Shape

func (t *Trip) Shape() *Shape

func (*Trip) Validate

func (t *Trip) Validate(opts ...ValidationOpts) error

type Trips

type Trips map[string]*Trip

func (Trips) DeduplicateServices

func (t Trips) DeduplicateServices()

Deduplicate removes duplicate services from the set.

func (Trips) DeduplicateShapes

func (t Trips) DeduplicateShapes()

Deduplicate removes duplicate shapes from the set.

func (*Trips) Validate

func (t *Trips) Validate(opts ...ValidationOpts) error

type ValidationOpts

type ValidationOpts func(*setValidationOpts)

func WithStrict

func WithStrict() ValidationOpts

func WithValidateRefs

func WithValidateRefs() ValidationOpts

type WheelchairInformation

type WheelchairInformation int8
const (
	WheelchairNoInformation WheelchairInformation = iota
	WheelchairAccessible
	WheelchairNotAccessible
)

func (*WheelchairInformation) Parse

func (wi *WheelchairInformation) Parse(text string) error

func (WheelchairInformation) String

func (wi WheelchairInformation) String() string

func (WheelchairInformation) Validate

func (wi WheelchairInformation) Validate() error

type WriteStreamProvider

type WriteStreamProvider interface {
	WriteStream(filename string) (io.WriteCloser, error)
}

type ZipReadProvider

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

func (*ZipReadProvider) ReadStream

func (z *ZipReadProvider) ReadStream(filename string) (io.ReadCloser, error)

type ZipWriteProvider

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

func (*ZipWriteProvider) WriteStream

func (z *ZipWriteProvider) WriteStream(filename string) (io.WriteCloser, error)

Jump to

Keyboard shortcuts

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