tl

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GTFSRTVERSION = "6fcc3800b15954227af7335d571791738afb1a67"

GTFSRTVERSION is the commit for the gtfs-realtime.proto file.

View Source
var GTFSVERSION = "11a49075c1f50d0130b934833b7eeb3fe518961c"

GTFSVERSION is the commit for the spec reference.md file.

View Source
var VERSION = "v0.16.0"

VERSION is the current software version.

Functions

func FeedVersionServiceBounds added in v0.12.0

func FeedVersionServiceBounds(reader Reader) (time.Time, time.Time, error)

func ValidateShapes

func ValidateShapes(shapes []Shape) []error

ValidateShapes returns errors for an array of shapes.

func ValidateStopTimes

func ValidateStopTimes(stoptimes []StopTime) []error

ValidateStopTimes checks if the trip follows GTFS rules.

Types

type Agency

type Agency struct {
	AgencyID       string
	AgencyName     string `csv:",required"`
	AgencyURL      string `csv:",required"`
	AgencyTimezone string `csv:",required"`
	AgencyLang     string
	AgencyPhone    string
	AgencyFareURL  string
	AgencyEmail    string
	BaseEntity
}

Agency agency.txt

func (*Agency) EntityID

func (ent *Agency) EntityID() string

EntityID returns the ID or AgencyID.

func (*Agency) EntityKey added in v0.7.1

func (ent *Agency) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Agency) Errors

func (ent *Agency) Errors() (errs []error)

Errors for this Entity.

func (*Agency) Filename

func (ent *Agency) Filename() string

Filename agency.txt

func (*Agency) TableName

func (ent *Agency) TableName() string

TableName gtfs_agencies

type Area added in v0.11.0

type Area struct {
	AreaID    String
	AreaName  String
	AgencyIDs Strings    `csv:"-" db:"agency_ids"` // interline ext
	Geometry  tt.Polygon `csv:"-"`                 // interline ext
	BaseEntity
}

Area fare_areas.txt

func (*Area) EntityID added in v0.11.0

func (ent *Area) EntityID() string

func (*Area) EntityKey added in v0.11.0

func (ent *Area) EntityKey() string

func (*Area) Errors added in v0.11.0

func (ent *Area) Errors() (errs []error)

func (*Area) Filename added in v0.11.0

func (ent *Area) Filename() string

func (*Area) TableName added in v0.11.0

func (ent *Area) TableName() string

type Attribution added in v0.10.0

type Attribution struct {
	OrganizationName String
	AgencyID         Key
	RouteID          Key
	TripID           Key
	IsProducer       Int
	IsOperator       Int
	IsAuthority      Int
	AttributionID    String
	AttributionURL   String
	AttributionEmail String
	AttributionPhone String
	BaseEntity
}

func (*Attribution) Errors added in v0.10.0

func (ent *Attribution) Errors() (errs []error)

Errors for this Entity.

func (*Attribution) Filename added in v0.10.0

func (ent *Attribution) Filename() string

func (*Attribution) TableName added in v0.10.0

func (ent *Attribution) TableName() string

func (*Attribution) UpdateKeys added in v0.10.0

func (ent *Attribution) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type Calendar

type Calendar struct {
	ServiceID string    `csv:",required"`
	Monday    int       `csv:",required"`
	Tuesday   int       `csv:",required"`
	Wednesday int       `csv:",required"`
	Thursday  int       `csv:",required"`
	Friday    int       `csv:",required"`
	Saturday  int       `csv:",required"`
	Sunday    int       `csv:",required"`
	StartDate time.Time `csv:",required"`
	EndDate   time.Time `csv:",required"`
	Generated bool      `csv:"-" db:"generated"`
	BaseEntity
}

Calendar calendars.txt

func (*Calendar) EntityID

func (ent *Calendar) EntityID() string

EntityID returns the ID or ServiceID.

func (*Calendar) EntityKey added in v0.7.1

func (ent *Calendar) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Calendar) Errors

func (ent *Calendar) Errors() (errs []error)

Errors for this Entity.

func (*Calendar) Filename

func (ent *Calendar) Filename() string

Filename calendar.txt

func (*Calendar) TableName

func (ent *Calendar) TableName() string

TableName gtfs_calendars

type CalendarDate

type CalendarDate struct {
	ServiceID     string    `csv:",required"`
	Date          time.Time `csv:",required"`
	ExceptionType int       `csv:",required"`
	BaseEntity
}

CalendarDate calendar_dates.txt

func (*CalendarDate) Errors

func (ent *CalendarDate) Errors() (errs []error)

Errors for this Entity.

func (*CalendarDate) Filename

func (ent *CalendarDate) Filename() string

Filename calendar_dates.txt

func (*CalendarDate) TableName

func (ent *CalendarDate) TableName() string

TableName gtfs_calendar_dates

func (*CalendarDate) UpdateKeys

func (ent *CalendarDate) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type DatabaseEntity added in v0.8.8

type DatabaseEntity struct {
	ID int `csv:"-"`
}

func (DatabaseEntity) GetID added in v0.8.8

func (ent DatabaseEntity) GetID() int

GetID returns the integer ID.

func (*DatabaseEntity) SetID added in v0.8.8

func (ent *DatabaseEntity) SetID(id int)

SetID sets the integer ID.

type Date added in v0.10.1

type Date = tt.Date

Aliases

type Entity

type Entity interface {
	EntityID() string
	Filename() string
}

Entity provides an interface for GTFS entities.

type EntityMap

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

EntityMap stores correspondances between Entity IDs, e.g. StopID -> Stop's integer ID in a database.

func NewEntityMap

func NewEntityMap() *EntityMap

NewEntityMap returns a new EntityMap.

func (*EntityMap) Get

func (emap *EntityMap) Get(efn string, eid string) (string, bool)

Get gets directly by filename, eid

func (*EntityMap) GetEntity

func (emap *EntityMap) GetEntity(ent Entity) (string, bool)

GetEntity returns the new ID for an Entity.

func (*EntityMap) KeysFor

func (emap *EntityMap) KeysFor(efn string) []string

KeysFor returns the keys for a filename.

func (*EntityMap) Set

func (emap *EntityMap) Set(efn string, oldid string, newid string) error

Set directly adds an entry to the set.

func (*EntityMap) SetEntity

func (emap *EntityMap) SetEntity(ent Entity, oldid string, newid string) error

SetEntity sets the old and new ID for an Entity.

func (*EntityMap) Update

func (emap *EntityMap) Update(other EntityMap)

Update copies values from another EntityMap.

type EntityWithErrors added in v0.11.0

type EntityWithErrors interface {
	Errors() []error
	Warnings() []error
	AddError(error)
	AddWarning(error)
}

type EntityWithExtra added in v0.11.0

type EntityWithExtra interface {
	SetExtra(string, string)
	GetExtra(string) (string, bool)
	ClearExtra()
	ExtraKeys() []string
}

type EntityWithID added in v0.11.0

type EntityWithID interface {
	GetID() int
}

type EntityWithReferences added in v0.11.0

type EntityWithReferences interface {
	UpdateKeys(*EntityMap) error
}

type ErrorEntity added in v0.11.0

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

///////

func (*ErrorEntity) AddError added in v0.11.0

func (ent *ErrorEntity) AddError(err error)

AddError adds a loading error to the entity, e.g. from a CSV parse failure

func (*ErrorEntity) AddWarning added in v0.11.0

func (ent *ErrorEntity) AddWarning(err error)

AddWarning .

func (*ErrorEntity) Errors added in v0.11.0

func (ent *ErrorEntity) Errors() []error

Errors returns validation errors.

func (*ErrorEntity) Warnings added in v0.11.0

func (ent *ErrorEntity) Warnings() []error

Errors returns validation errors.

type ExtraEntity added in v0.11.0

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

func (*ExtraEntity) ClearExtra added in v0.13.0

func (ent *ExtraEntity) ClearExtra()

func (*ExtraEntity) ExtraKeys added in v0.11.0

func (ent *ExtraEntity) ExtraKeys() []string

func (*ExtraEntity) GetExtra added in v0.11.0

func (ent *ExtraEntity) GetExtra(key string) (string, bool)

func (*ExtraEntity) SetExtra added in v0.11.0

func (ent *ExtraEntity) SetExtra(key string, value string)

SetExtra adds a string key, value pair to the entity's extra fields.

type FareAttribute

type FareAttribute struct {
	FareID           string  `csv:",required"`
	Price            float64 `csv:",required"`
	CurrencyType     string  `csv:",required"`
	PaymentMethod    int     `csv:",required"`
	Transfers        Int
	AgencyID         Key
	TransferDuration int
	BaseEntity
}

FareAttribute fare_attributes.txt

func (*FareAttribute) EntityID

func (ent *FareAttribute) EntityID() string

EntityID returns the ID or FareID.

func (*FareAttribute) EntityKey added in v0.7.1

func (ent *FareAttribute) EntityKey() string

EntityKey returns the GTFS identifier.

func (*FareAttribute) Errors

func (ent *FareAttribute) Errors() (errs []error)

Errors for this Entity.

func (*FareAttribute) Filename

func (ent *FareAttribute) Filename() string

Filename fare_attributes.txt

func (*FareAttribute) TableName

func (ent *FareAttribute) TableName() string

TableName gtfs_fare_attributes

func (*FareAttribute) UpdateKeys

func (ent *FareAttribute) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type FareLegRule added in v0.11.0

type FareLegRule struct {
	LegGroupID    String
	FromAreaID    String
	ToAreaID      String
	NetworkID     String
	FareProductID String
	TransferOnly  tt.Int // interline ext
	BaseEntity
}

FareLegRule fare_leg_rules.txt

func (*FareLegRule) EntityID added in v0.11.0

func (ent *FareLegRule) EntityID() string

func (*FareLegRule) Errors added in v0.11.0

func (ent *FareLegRule) Errors() (errs []error)

func (*FareLegRule) Filename added in v0.11.0

func (ent *FareLegRule) Filename() string

func (*FareLegRule) String added in v0.11.0

func (ent *FareLegRule) String() string

func (*FareLegRule) TableName added in v0.11.0

func (ent *FareLegRule) TableName() string

func (*FareLegRule) UpdateKeys added in v0.11.0

func (ent *FareLegRule) UpdateKeys(emap *EntityMap) error

type FareMedia added in v0.13.0

type FareMedia struct {
	FareMediaID   String
	FareMediaName String
	FareMediaType Int
	BaseEntity
}

FareMedia fare_media.txt

func (*FareMedia) EntityID added in v0.13.0

func (ent *FareMedia) EntityID() string

func (*FareMedia) EntityKey added in v0.13.0

func (ent *FareMedia) EntityKey() string

func (*FareMedia) Errors added in v0.13.0

func (ent *FareMedia) Errors() (errs []error)

func (*FareMedia) Filename added in v0.13.0

func (ent *FareMedia) Filename() string

func (*FareMedia) TableName added in v0.13.0

func (ent *FareMedia) TableName() string

type FareProduct added in v0.11.0

type FareProduct struct {
	FareProductID   String
	FareProductName String
	Amount          tt.CurrencyAmount // Experimental formatting
	Currency        String
	DurationStart   Int   // proposed extension
	DurationAmount  Float // proposed extension
	DurationUnit    Int   // proposed extension
	DurationType    Int   // proposed extension
	RiderCategoryID Key   // proposed extension
	FareMediaID     Key   // proposed extension
	BaseEntity
}

FareProduct fare_products.txt

func (*FareProduct) EntityID added in v0.11.0

func (ent *FareProduct) EntityID() string

func (*FareProduct) Errors added in v0.11.0

func (ent *FareProduct) Errors() (errs []error)

func (*FareProduct) Filename added in v0.11.0

func (ent *FareProduct) Filename() string

func (*FareProduct) GetValue added in v0.13.0

func (ent *FareProduct) GetValue(key string) (any, bool)

func (*FareProduct) String added in v0.11.0

func (ent *FareProduct) String() string

func (*FareProduct) TableName added in v0.11.0

func (ent *FareProduct) TableName() string

func (*FareProduct) UpdateKeys added in v0.11.0

func (ent *FareProduct) UpdateKeys(emap *EntityMap) error

type FareRule

type FareRule struct {
	FareID        string `csv:",required"`
	RouteID       Key
	OriginID      string
	DestinationID string
	ContainsID    string
	BaseEntity
}

FareRule fare_rules.txt

func (*FareRule) Errors

func (ent *FareRule) Errors() (errs []error)

Errors for this Entity.

func (*FareRule) Filename

func (ent *FareRule) Filename() string

Filename fare_rules.txt

func (*FareRule) TableName

func (ent *FareRule) TableName() string

TableName gtfs_fare_Rules

func (*FareRule) UpdateKeys

func (ent *FareRule) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type FareTransferRule added in v0.11.0

type FareTransferRule struct {
	FromLegGroupID      tt.String
	ToLegGroupID        tt.String
	TransferCount       tt.Int
	DurationLimit       tt.Int
	DurationLimitType   tt.Int
	FareTransferType    tt.Int
	FareProductID       tt.String
	FilterFareProductID tt.String // proposed extension
	BaseEntity
}

FareTransferRule fare_transfer_rules.txt

func (*FareTransferRule) Errors added in v0.11.0

func (ent *FareTransferRule) Errors() (errs []error)

func (*FareTransferRule) Filename added in v0.11.0

func (ent *FareTransferRule) Filename() string

func (*FareTransferRule) String added in v0.11.0

func (ent *FareTransferRule) String() string

func (*FareTransferRule) TableName added in v0.11.0

func (ent *FareTransferRule) TableName() string

func (*FareTransferRule) UpdateKeys added in v0.11.0

func (ent *FareTransferRule) UpdateKeys(emap *EntityMap) error

type Feed

type Feed struct {
	ID            int               `json:"-"`
	FeedID        string            `json:"id" db:"onestop_id"`
	SupersedesIDs Strings           `json:"supersedes_ids,omitempty" db:"-"`
	Name          String            `json:"name,omitempty"`
	Description   String            `json:"description,omitempty"`
	Spec          string            `json:"spec,omitempty"`
	URLs          FeedUrls          `json:"urls,omitempty" db:"urls"`
	Languages     FeedLanguages     `json:"languages,omitempty"`
	License       FeedLicense       `json:"license,omitempty"`
	Authorization FeedAuthorization `json:"authorization,omitempty" db:"auth"`
	Tags          Tags              `json:"tags,omitempty" db:"feed_tags" `
	File          string            `json:"-"` // internal
	DeletedAt     Time              `json:"-"` // internal
	Timestamps    `json:"-"`        // internal
}

Feed listed in a parsed DMFR file

func (*Feed) EntityID

func (ent *Feed) EntityID() string

EntityID .

func (*Feed) Equal added in v0.8.5

func (ent *Feed) Equal(other *Feed) bool

Equal compares the JSON representation of two feeds

func (*Feed) GetID added in v0.7.1

func (ent *Feed) GetID() int

GetID .

func (*Feed) MatchSecrets added in v0.10.1

func (ent *Feed) MatchSecrets(secrets []Secret, urltype string) (Secret, error)

func (*Feed) SetID added in v0.7.1

func (ent *Feed) SetID(id int)

SetID .

func (Feed) TableName

func (Feed) TableName() string

TableName .

type FeedAssociatedFeeds

type FeedAssociatedFeeds []string

FeedAssociatedFeeds .

func (*FeedAssociatedFeeds) Scan

func (a *FeedAssociatedFeeds) Scan(value interface{}) error

Scan .

func (FeedAssociatedFeeds) Value

func (a FeedAssociatedFeeds) Value() (driver.Value, error)

Value .

type FeedAuthorization

type FeedAuthorization struct {
	Type      string `json:"type,omitempty"` // ["header", "basic_auth", "query_param", "path_segment", "replace_url"]
	ParamName string `json:"param_name,omitempty"`
	InfoURL   string `json:"info_url,omitempty"`
}

FeedAuthorization contains details about how to access a Feed.

func (*FeedAuthorization) Scan

func (a *FeedAuthorization) Scan(value interface{}) error

Scan .

func (FeedAuthorization) Value

func (a FeedAuthorization) Value() (driver.Value, error)

Value .

type FeedInfo

type FeedInfo struct {
	FeedPublisherName string `csv:",required"`
	FeedPublisherURL  string `csv:",required"`
	FeedLang          string `csv:",required"`
	FeedVersion       string `db:"feed_version_name"`
	FeedStartDate     Date
	FeedEndDate       Date
	DefaultLang       String
	FeedContactEmail  String
	FeedContactURL    String
	BaseEntity
}

FeedInfo feed_info.txt

func (*FeedInfo) Errors

func (ent *FeedInfo) Errors() (errs []error)

Errors for this Entity.

func (*FeedInfo) Filename

func (ent *FeedInfo) Filename() string

Filename feed_info.txt

func (*FeedInfo) TableName

func (ent *FeedInfo) TableName() string

TableName gtfs_feed_infos

type FeedLanguages

type FeedLanguages []string

FeedLanguages .

func (*FeedLanguages) Scan

func (a *FeedLanguages) Scan(value interface{}) error

Scan .

func (FeedLanguages) Value

func (a FeedLanguages) Value() (driver.Value, error)

Value .

type FeedLicense

type FeedLicense struct {
	SpdxIdentifier          string `json:"spdx_identifier,omitempty"`
	URL                     string `json:"url,omitempty"`
	UseWithoutAttribution   string `json:"use_without_attribution,omitempty"`
	CreateDerivedProduct    string `json:"create_derived_product,omitempty"`
	RedistributionAllowed   string `json:"redistribution_allowed,omitempty"`
	CommercialUseAllowed    string `json:"commercial_use_allowed,omitempty"`
	ShareAlikeOptional      string `json:"share_alike_optional,omitempty"`
	AttributionText         string `json:"attribution_text,omitempty"`
	AttributionInstructions string `json:"attribution_instructions,omitempty"`
}

FeedLicense describes the license and usage information for a Feed.

func (*FeedLicense) Scan

func (a *FeedLicense) Scan(value interface{}) error

Scan .

func (FeedLicense) Value

func (a FeedLicense) Value() (driver.Value, error)

Value .

type FeedUrls

type FeedUrls struct {
	StaticCurrent            string   `json:"static_current,omitempty"`
	StaticPlanned            string   `json:"static_planner,omitempty"`
	StaticHistoric           []string `json:"static_historic,omitempty"`
	RealtimeVehiclePositions string   `json:"realtime_vehicle_positions,omitempty"`
	RealtimeTripUpdates      string   `json:"realtime_trip_updates,omitempty"`
	RealtimeAlerts           string   `json:"realtime_alerts,omitempty"`
	GbfsAutoDiscovery        string   `json:"gbfs_auto_discovery,omitempty"`
	GbfsSystemAlerts         string   `json:"gbfs_system_alerts,omitempty"`
	MdsProvider              string   `json:"mds_provider,omitempty"`
}

FeedUrls contains URL values for a Feed.

func (*FeedUrls) Scan

func (a *FeedUrls) Scan(value interface{}) error

Scan .

func (FeedUrls) Value

func (a FeedUrls) Value() (driver.Value, error)

Value .

type FeedVersion

type FeedVersion struct {
	ID                   int
	FeedID               int
	FeedType             string
	SHA1                 string
	SHA1Dir              string
	File                 string
	URL                  string
	EarliestCalendarDate Date
	LatestCalendarDate   Date
	FetchedAt            time.Time
	Fragment             String
	Name                 String
	Description          String
	CreatedBy            String
	UpdatedBy            String
	Timestamps
}

FeedVersion represents a single GTFS data source.

func NewFeedVersionFromReader

func NewFeedVersionFromReader(reader Reader) (FeedVersion, error)

NewFeedVersionFromReader returns a FeedVersion from a Reader.

func (*FeedVersion) EntityID

func (ent *FeedVersion) EntityID() string

EntityID .

func (*FeedVersion) GetID added in v0.7.1

func (ent *FeedVersion) GetID() int

GetID .

func (*FeedVersion) SetID added in v0.7.1

func (ent *FeedVersion) SetID(id int)

SetID .

func (*FeedVersion) TableName

func (ent *FeedVersion) TableName() string

TableName sets the table name prefix.

type FeedVersionEntity added in v0.8.8

type FeedVersionEntity struct {
	FeedVersionID int `csv:"-"`
}

func (*FeedVersionEntity) GetFeedVersionID added in v0.16.0

func (ent *FeedVersionEntity) GetFeedVersionID() int

GetFeedVersionID returns the Entity's FeedVersionID.

func (*FeedVersionEntity) SetFeedVersionID added in v0.8.8

func (ent *FeedVersionEntity) SetFeedVersionID(fvid int)

SetFeedVersionID sets the Entity's FeedVersionID.

type Float added in v0.10.1

type Float = tt.Float

type Frequency

type Frequency struct {
	TripID      string `csv:",required"`
	HeadwaySecs int    `csv:",required"`
	StartTime   WideTime
	EndTime     WideTime
	ExactTimes  int
	BaseEntity
}

Frequency frequencies.txt

func (*Frequency) Errors

func (ent *Frequency) Errors() (errs []error)

Errors for this Entity.

func (*Frequency) Filename

func (ent *Frequency) Filename() string

Filename frequencies.txt

func (*Frequency) RepeatCount added in v0.7.1

func (ent *Frequency) RepeatCount() int

RepeatCount returns the number of times this trip will be repeated.

func (*Frequency) TableName

func (ent *Frequency) TableName() string

TableName gtfs_frequencies

func (*Frequency) UpdateKeys

func (ent *Frequency) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type Geometry added in v0.8.0

type Geometry = tt.Geometry

type Int added in v0.10.1

type Int = tt.Int

type Ints added in v0.11.0

type Ints = tt.Ints

type Key added in v0.10.1

type Key = tt.Key

type Level

type Level struct {
	LevelID    string  `csv:",required"`
	LevelIndex float64 `csv:",required"`
	LevelName  string  `csv:"level_name"`
	BaseEntity
}

Level levels.txt

func (*Level) EntityID

func (ent *Level) EntityID() string

EntityID returns the ID or StopID.

func (*Level) EntityKey added in v0.7.1

func (ent *Level) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Level) Filename

func (ent *Level) Filename() string

Filename levels.txt

func (*Level) TableName

func (ent *Level) TableName() string

TableName ext_pathways_levels

type LineEntity added in v0.16.0

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

func (LineEntity) Line added in v0.16.0

func (ent LineEntity) Line() int

func (*LineEntity) SetLine added in v0.16.0

func (ent *LineEntity) SetLine(line int)

type LineString

type LineString = tt.LineString

type MinEntity added in v0.8.8

type MinEntity struct {
}

MinEntity provides minimum set of default methods.

func (MinEntity) EntityID added in v0.8.8

func (ent MinEntity) EntityID() string

EntityID returns the entity ID.

func (MinEntity) Filename added in v0.8.8

func (ent MinEntity) Filename() string

Filename returns the filename for this entity.

func (*MinEntity) UpdateKeys added in v0.8.8

func (ent *MinEntity) UpdateKeys(emap *EntityMap) error

UpdateKeys updates entity referencespdates foreign keys based on an EntityMap.

type Operator added in v0.8.5

type Operator struct {
	ID              int                     `json:"-"`
	OnestopID       String                  `json:"onestop_id"`
	SupersedesIDs   Strings                 `json:"supersedes_ids,omitempty" db:"-"`
	Name            String                  `json:"name,omitempty"`
	ShortName       String                  `json:"short_name,omitempty"`
	Website         String                  `json:"website,omitempty"`
	AssociatedFeeds OperatorAssociatedFeeds `json:"associated_feeds,omitempty"`
	Tags            Tags                    `json:"tags,omitempty" db:"operator_tags"`
	File            String                  `json:"-"` // internal
	DeletedAt       Time                    `json:"-"` // internal
	Timestamps      `json:"-"`
}

func (*Operator) Equal added in v0.8.5

func (ent *Operator) Equal(other *Operator) bool

Equal compares the JSON representation of two operators.

func (*Operator) GetID added in v0.8.5

func (ent *Operator) GetID() int

GetID .

func (*Operator) SetID added in v0.8.5

func (ent *Operator) SetID(id int)

SetID .

func (Operator) TableName added in v0.8.5

func (Operator) TableName() string

TableName .

type OperatorAssociatedFeed added in v0.8.5

type OperatorAssociatedFeed struct {
	GtfsAgencyID         String `json:"gtfs_agency_id,omitempty" db:"gtfs_agency_id"`
	FeedOnestopID        String `json:"feed_onestop_id,omitempty" db:"-"`
	ResolvedOnestopID    String `json:"-"` // internal
	ResolvedGtfsAgencyID String `json:"-"` // internal
	ResolvedName         String `json:"-"` // internal
	ResolvedShortName    String `json:"-"` // internal
	ResolvedPlaces       String `json:"-"` // internal
	OperatorID           Int    `json:"-"` // internal
	ID                   int    `json:"-"` // internal
	FeedID               int    `json:"-"` // internal
}

func (OperatorAssociatedFeed) TableName added in v0.8.5

func (o OperatorAssociatedFeed) TableName() string

type OperatorAssociatedFeeds added in v0.8.5

type OperatorAssociatedFeeds []OperatorAssociatedFeed

OperatorAssociatedFeeds is necessary to scan correctly from database

func (OperatorAssociatedFeeds) MarshalGQL added in v0.8.5

func (r OperatorAssociatedFeeds) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface

func (*OperatorAssociatedFeeds) Scan added in v0.8.5

func (a *OperatorAssociatedFeeds) Scan(value interface{}) error

Scan .

func (*OperatorAssociatedFeeds) UnmarshalGQL added in v0.8.5

func (r *OperatorAssociatedFeeds) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface

func (OperatorAssociatedFeeds) Value added in v0.8.5

Value .

type Pathway

type Pathway struct {
	PathwayID           string  `csv:",required"`
	FromStopID          string  `csv:",required"`
	ToStopID            string  `csv:",required"`
	PathwayMode         int     `csv:",required"`
	IsBidirectional     int     `csv:",required"`
	Length              float64 `csv:"length" min:"0"`
	TraversalTime       int     `csv:"traversal_time" min:"0"`
	StairCount          int     `csv:"stair_count"`
	MaxSlope            float64 `csv:"max_slope"`
	MinWidth            float64 `csv:"min_width"`
	SignpostedAs        string  `csv:"signposted_as"`
	ReverseSignpostedAs string  `csv:"reversed_signposted_as"`
	BaseEntity
}

Pathway pathways.txt

func (*Pathway) EntityID

func (ent *Pathway) EntityID() string

EntityID returns the ID or StopID.

func (*Pathway) EntityKey added in v0.7.1

func (ent *Pathway) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Pathway) Filename

func (ent *Pathway) Filename() string

Filename pathways.txt

func (*Pathway) GetString

func (ent *Pathway) GetString(key string) (string, error)

GetString returns the string representation of an field.

func (*Pathway) TableName

func (ent *Pathway) TableName() string

TableName ext_pathway_pathways

func (*Pathway) UpdateKeys

func (ent *Pathway) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type Point

type Point = tt.Point

type Polygon added in v0.7.2

type Polygon = tt.Polygon

type Reader

type Reader interface {
	Open() error
	Close() error
	ValidateStructure() []error
	StopTimesByTripID(...string) chan []StopTime
	String() string
	// Entities
	ReadEntities(c interface{}) error
	Stops() chan Stop
	StopTimes() chan StopTime
	Agencies() chan Agency
	Calendars() chan Calendar
	CalendarDates() chan CalendarDate
	FareAttributes() chan FareAttribute
	FareRules() chan FareRule
	FeedInfos() chan FeedInfo
	Frequencies() chan Frequency
	Routes() chan Route
	Shapes() chan Shape
	Transfers() chan Transfer
	Pathways() chan Pathway
	Levels() chan Level
	Trips() chan Trip
	Translations() chan Translation
	Attributions() chan Attribution
	Areas() chan Area
	StopAreas() chan StopArea
	FareLegRules() chan FareLegRule
	FareTransferRules() chan FareTransferRule
	FareProducts() chan FareProduct
	RiderCategories() chan RiderCategory
	FareMedia() chan FareMedia
}

Reader defines an interface for reading entities from a GTFS feed.

type ReferenceEntity added in v0.11.0

type ReferenceEntity struct {
}

type RiderCategory added in v0.11.0

type RiderCategory struct {
	RiderCategoryID   string
	RiderCategoryName string
	MinAge            Int
	MaxAge            Int
	EligibilityURL    String
	BaseEntity
}

RiderCategory rider_categories.txt

func (*RiderCategory) Errors added in v0.11.0

func (ent *RiderCategory) Errors() (errs []error)

func (*RiderCategory) Filename added in v0.11.0

func (ent *RiderCategory) Filename() string

func (*RiderCategory) TableName added in v0.11.0

func (ent *RiderCategory) TableName() string

type Route

type Route struct {
	RouteID           string `csv:",required"`
	AgencyID          string
	RouteShortName    string
	RouteLongName     string
	RouteDesc         string
	RouteType         int `csv:",required"`
	RouteURL          string
	RouteColor        string
	RouteTextColor    string
	RouteSortOrder    int
	ContinuousPickup  Int
	ContinuousDropOff Int
	NetworkID         String
	AsRoute           Int
	Geometry          Geometry `csv:"-" db:"-"`
	BaseEntity
}

Route routes.txt

func (*Route) EntityID

func (ent *Route) EntityID() string

EntityID returns ID or RouteID.

func (*Route) EntityKey added in v0.7.1

func (ent *Route) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Route) Errors

func (ent *Route) Errors() (errs []error)

Errors for this Entity.

func (*Route) Filename

func (ent *Route) Filename() string

Filename routes.txt

func (*Route) TableName

func (ent *Route) TableName() string

TableName gtfs_routes

func (*Route) UpdateKeys

func (ent *Route) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type Secret added in v0.10.1

type Secret struct {
	Key                string `json:"key"`
	Username           string `json:"username"`
	Password           string `json:"password"`
	AWSAccessKeyID     string `json:"aws_access_key_id"`
	AWSSecretAccessKey string `json:"aws_secret_access_key"`
	FeedID             string `json:"feed_id"`
	Filename           string `json:"filename"`
	URLType            string `json:"url_type"`
	ReplaceUrl         string `json:"replace_url"`
}

Secret .

func (Secret) MatchFeed added in v0.10.1

func (s Secret) MatchFeed(feedid string) bool

MatchFeed finds secrets associated with a DMFR FeedID.

func (Secret) MatchFilename added in v0.10.1

func (s Secret) MatchFilename(filename string) bool

MatchFilename finds secrets associated with a DMFR filename.

type Service

type Service struct {
	Calendar
	// contains filtered or unexported fields
}

Service is a Calendar / CalendarDate union.

func NewService

func NewService(c Calendar, cds ...CalendarDate) *Service

NewService returns a new Service.

func NewServicesFromReader

func NewServicesFromReader(reader Reader) []*Service

NewServicesFromReader returns the reader's Calendar and CalendarDate entities as a Service

func (*Service) AddCalendarDate

func (s *Service) AddCalendarDate(cd CalendarDate) error

AddCalendarDate adds a service exception.

func (*Service) CalendarDates added in v0.8.0

func (s *Service) CalendarDates() []CalendarDate

CalendarDates returns CalendarDates for this service.

func (*Service) Exception added in v0.8.0

func (s *Service) Exception(t time.Time) (int, bool)

func (*Service) GetWeekday added in v0.8.0

func (s *Service) GetWeekday(dow int) (int, error)

GetWeekday returns the value fo the day of week.

func (*Service) HasAtLeastOneDay added in v0.8.0

func (s *Service) HasAtLeastOneDay() bool

HasAtLeastOneDay checks if the Service is active for at least one day.

func (*Service) IsActive

func (s *Service) IsActive(t time.Time) bool

IsActive returns if this Service period is active on a specified date.

func (*Service) Reset added in v0.8.8

func (s *Service) Reset()

Reset resets calendars, except ServiceID

func (*Service) ServicePeriod

func (s *Service) ServicePeriod() (time.Time, time.Time)

ServicePeriod returns the widest possible range of days with transit service, including service exceptions.

func (*Service) SetWeekday added in v0.8.0

func (s *Service) SetWeekday(dow int, value int) error

SetWeekday sets the day of week.

func (*Service) Simplify added in v0.8.0

func (s *Service) Simplify() (*Service, error)

Simplify tries to simplify exceptions down to a basic calendar with fewer exceptions.

type Shape

type Shape struct {
	ShapeID           string     `csv:",required"`
	ShapePtLat        float64    `db:"-" csv:",required"`
	ShapePtLon        float64    `db:"-" csv:",required"`
	ShapePtSequence   int        `db:"-" csv:",required"`
	ShapeDistTraveled float64    `db:"-"`
	Geometry          LineString `db:"geometry" csv:"-"`
	Generated         bool       `db:"generated" csv:"-"`
	BaseEntity
}

Shape shapes.txt

func NewShapeFromShapes

func NewShapeFromShapes(shapes []Shape) Shape

NewShapeFromShapes takes Shapes with single points and returns a Shape with linestring geometry. Any errors from the input errors, or errors such as duplicate sequences, are added as entity errors.

func (*Shape) EntityID

func (ent *Shape) EntityID() string

EntityID returns the ID or ShapeID.

func (*Shape) EntityKey added in v0.7.1

func (ent *Shape) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Shape) Errors

func (ent *Shape) Errors() (errs []error)

Errors for this Entity.

func (*Shape) Filename

func (ent *Shape) Filename() string

Filename shapes.txt

func (*Shape) SetString

func (ent *Shape) SetString(key string, value string) error

SetString provides a fast, non-reflect loading path.

func (*Shape) TableName

func (ent *Shape) TableName() string

TableName gtfs_shapes

type Stop

type Stop struct {
	StopID             string `csv:",required" required:"true"`
	StopName           string
	StopCode           string
	StopDesc           string
	StopLat            float64 `db:"-"` // csv load to Geometry
	StopLon            float64 `db:"-"`
	ZoneID             string
	StopURL            string
	TtsStopName        String
	PlatformCode       String
	LocationType       int
	ParentStation      Key
	StopTimezone       string
	WheelchairBoarding int
	LevelID            Key
	Geometry           Point `csv:"-" db:"geometry"`
	BaseEntity
}

Stop stops.txt

func (*Stop) Coordinates

func (ent *Stop) Coordinates() [2]float64

Coordinates returns the stop lon,lat as a [2]float64

func (*Stop) EntityID

func (ent *Stop) EntityID() string

EntityID returns the ID or StopID.

func (*Stop) EntityKey added in v0.7.1

func (ent *Stop) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Stop) Errors

func (ent *Stop) Errors() (errs []error)

Errors for this Entity.

func (*Stop) Filename

func (ent *Stop) Filename() string

Filename stops.txt

func (*Stop) SetCoordinates

func (ent *Stop) SetCoordinates(p [2]float64)

SetCoordinates takes a [2]float64 and sets the Stop's lon,lat

func (*Stop) TableName

func (ent *Stop) TableName() string

TableName gtfs_stops

func (*Stop) UpdateKeys

func (ent *Stop) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type StopArea added in v0.11.0

type StopArea struct {
	AreaID string
	StopID string
	BaseEntity
}

StopArea stop_areas.txt

func (*StopArea) Errors added in v0.11.0

func (ent *StopArea) Errors() (errs []error)

func (*StopArea) Filename added in v0.11.0

func (ent *StopArea) Filename() string

func (*StopArea) TableName added in v0.11.0

func (ent *StopArea) TableName() string

func (*StopArea) UpdateKeys added in v0.11.0

func (ent *StopArea) UpdateKeys(emap *EntityMap) error

type StopTime

type StopTime struct {
	TripID            string
	StopID            string `csv:",required" required:"true"`
	StopSequence      int    `csv:",required" required:"true"`
	StopHeadsign      String
	ArrivalTime       WideTime
	DepartureTime     WideTime
	PickupType        Int
	DropOffType       Int
	ContinuousPickup  Int
	ContinuousDropOff Int
	ShapeDistTraveled Float
	Timepoint         Int
	Interpolated      Int `csv:"-"` // interpolated times: 0 for provided, 1 interpolated // TODO: 1 for shape, 2 for straight-line
	MinEntity
	ErrorEntity
	ExtraEntity
	FeedVersionEntity
}

StopTime stop_times.txt

func (*StopTime) Errors

func (ent *StopTime) Errors() []error

Errors for this Entity.

func (*StopTime) Filename

func (ent *StopTime) Filename() string

Filename stop_times.txt

func (*StopTime) GetString

func (ent *StopTime) GetString(key string) (string, error)

GetString returns the string representation of an field.

func (*StopTime) SetString

func (ent *StopTime) SetString(key, value string) error

SetString provides a fast, non-reflect loading path.

func (*StopTime) TableName

func (ent *StopTime) TableName() string

TableName gtfs_stop_times

func (*StopTime) UpdateKeys

func (ent *StopTime) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type String added in v0.10.1

type String = tt.String

type Strings added in v0.10.3

type Strings = tt.Strings

type Tags added in v0.8.5

type Tags = tt.Tags

type Time added in v0.10.1

type Time = tt.Time

type Timestamps

type Timestamps struct {
	CreatedAt time.Time `csv:"-"`
	UpdatedAt time.Time `csv:"-"`
}

Timestamps .

func (*Timestamps) UpdateTimestamps

func (ent *Timestamps) UpdateTimestamps()

UpdateTimestamps initializes or updates CreatedAt / UpdatedAt

type Transfer

type Transfer struct {
	FromStopID      string
	ToStopID        string
	FromRouteID     Key
	ToRouteID       Key
	FromTripID      Key
	ToTripID        Key
	TransferType    int
	MinTransferTime Int
	BaseEntity
}

Transfer transfers.txt

func (*Transfer) Errors

func (ent *Transfer) Errors() (errs []error)

Errors for this Entity.

func (*Transfer) Filename

func (ent *Transfer) Filename() string

Filename transfers.txt

func (*Transfer) TableName

func (ent *Transfer) TableName() string

TableName gtfs_transfers

func (*Transfer) UpdateKeys

func (ent *Transfer) UpdateKeys(emap *EntityMap) error

UpdateKeys updates entity references.

type Translation added in v0.10.0

type Translation struct {
	// "TableNameValue" because TableName is a required interface method
	TableNameValue String `db:"table_name" csv:"table_name"`
	FieldName      String
	Language       String
	Translation    String
	RecordID       String
	RecordSubID    String
	FieldValue     String
	BaseEntity
}

func (*Translation) Errors added in v0.10.0

func (ent *Translation) Errors() (errs []error)

Errors for this Entity.

func (*Translation) Filename added in v0.10.0

func (ent *Translation) Filename() string

func (*Translation) TableName added in v0.10.0

func (ent *Translation) TableName() string

type Trip

type Trip struct {
	RouteID              string `csv:",required"`
	ServiceID            string `csv:",required"`
	TripID               string `csv:",required"`
	TripHeadsign         string
	TripShortName        string
	DirectionID          int
	BlockID              string
	ShapeID              Key
	WheelchairAccessible int
	BikesAllowed         int
	StopTimes            []StopTime `csv:"-" db:"-"` // for validation methods
	StopPatternID        int        `csv:"-"`
	JourneyPatternID     string     `csv:"-"`
	JourneyPatternOffset int        `csv:"-"`
	BaseEntity
}

Trip trips.txt

func (*Trip) EntityID

func (ent *Trip) EntityID() string

EntityID returns the ID or TripID.

func (*Trip) EntityKey added in v0.7.1

func (ent *Trip) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Trip) Errors

func (ent *Trip) Errors() (errs []error)

Errors for this Entity.

func (*Trip) Filename

func (ent *Trip) Filename() string

Filename trips.txt

func (*Trip) TableName

func (ent *Trip) TableName() string

TableName gtfs_trips

func (*Trip) UpdateKeys

func (ent *Trip) UpdateKeys(emap *EntityMap) error

UpdateKeys updates Entity references.

type WideTime

type WideTime = tt.WideTime

type Writer

type Writer interface {
	Open() error
	Close() error
	Create() error
	Delete() error
	NewReader() (Reader, error)
	AddEntity(Entity) (string, error)
	AddEntities([]Entity) ([]string, error)
	String() string
}

Writer writes a GTFS feed.

type WriterWithExtraColumns added in v0.11.0

type WriterWithExtraColumns interface {
	Writer
	WriteExtraColumns(bool)
}

Directories

Path Synopsis
Package tests must be in a separate package to avoid circular imports
Package tests must be in a separate package to avoid circular imports

Jump to

Keyboard shortcuts

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