Documentation
¶
Index ¶
- Variables
- func SecondsToString(secs int) string
- func StringToSeconds(value string) (int, error)
- func ValidateShapes(shapes []Shape) []error
- func ValidateStopTimes(stoptimes []StopTime) []error
- type Agency
- type Attribution
- type BaseEntity
- type Calendar
- type CalendarDate
- type DatabaseEntity
- type Date
- func (r *Date) IsZero() bool
- func (r Date) MarshalGQL(w io.Writer)
- func (r *Date) MarshalJSON() ([]byte, error)
- func (r *Date) Scan(src interface{}) error
- func (r *Date) String() string
- func (r *Date) UnmarshalGQL(src interface{}) error
- func (r *Date) UnmarshalJSON(v []byte) error
- func (r Date) Value() (driver.Value, error)
- type Entity
- type EntityError
- type EntityMap
- func (emap *EntityMap) Get(efn string, eid string) (string, bool)
- func (emap *EntityMap) GetEntity(ent Entity) (string, bool)
- func (emap *EntityMap) KeysFor(efn string) []string
- func (emap *EntityMap) Set(efn string, oldid string, newid string) error
- func (emap *EntityMap) SetEntity(ent Entity, oldid string, newid string) error
- func (emap *EntityMap) Update(other EntityMap)
- type FareAttribute
- type FareRule
- type Feed
- type FeedAssociatedFeeds
- type FeedAuthorization
- type FeedInfo
- type FeedLanguages
- type FeedLicense
- type FeedUrls
- type FeedVersion
- type FeedVersionEntity
- type Float
- func (r Float) MarshalGQL(w io.Writer)
- func (r *Float) MarshalJSON() ([]byte, error)
- func (r *Float) Scan(src interface{}) error
- func (r *Float) String() string
- func (r *Float) UnmarshalGQL(v interface{}) error
- func (r *Float) UnmarshalJSON(v []byte) error
- func (r Float) Value() (driver.Value, error)
- type Frequency
- type Geometry
- type Int
- type IntSlice
- type Key
- func (r *Key) Int() int
- func (r Key) MarshalGQL(w io.Writer)
- func (r *Key) MarshalJSON() ([]byte, error)
- func (r *Key) Scan(src interface{}) error
- func (r *Key) String() string
- func (r *Key) UnmarshalGQL(v interface{}) error
- func (r *Key) UnmarshalJSON(v []byte) error
- func (r Key) Value() (driver.Value, error)
- type Level
- type LineString
- type MinEntity
- func (ent *MinEntity) AddError(err error)
- func (ent *MinEntity) AddWarning(err error)
- func (ent *MinEntity) EntityID() string
- func (ent *MinEntity) Errors() []error
- func (ent *MinEntity) Extra() map[string]string
- func (ent *MinEntity) Filename() string
- func (ent *MinEntity) SetExtra(key string, value string)
- func (ent *MinEntity) UpdateKeys(emap *EntityMap) error
- func (ent *MinEntity) Warnings() []error
- type NullWriter
- func (*NullWriter) AddEntities(ents []Entity) ([]string, error)
- func (*NullWriter) AddEntity(ent Entity) (string, error)
- func (*NullWriter) Close() error
- func (*NullWriter) Create() error
- func (*NullWriter) Delete() error
- func (*NullWriter) NewReader() (Reader, error)
- func (*NullWriter) Open() error
- func (*NullWriter) String() string
- type ODate
- type OFloat
- type OInt
- type OKey
- type OString
- type OTime
- type Operator
- type OperatorAssociatedFeed
- type OperatorAssociatedFeeds
- type Pathway
- type Point
- type Polygon
- type Reader
- type Route
- type Secret
- type Service
- func (s *Service) AddCalendarDate(cd CalendarDate) error
- func (s *Service) CalendarDates() []CalendarDate
- func (s *Service) Exception(t time.Time) (int, bool)
- func (s *Service) GetWeekday(dow int) (int, error)
- func (s *Service) HasAtLeastOneDay() bool
- func (s *Service) IsActive(t time.Time) bool
- func (s *Service) Reset()
- func (s *Service) ServicePeriod() (time.Time, time.Time)
- func (s *Service) SetWeekday(dow int, value int) error
- func (s *Service) Simplify() (*Service, error)
- type Shape
- type Stop
- func (ent *Stop) Coordinates() [2]float64
- func (ent *Stop) EntityID() string
- func (ent *Stop) EntityKey() string
- func (ent *Stop) Errors() (errs []error)
- func (ent *Stop) Filename() string
- func (ent *Stop) SetCoordinates(p [2]float64)
- func (ent *Stop) TableName() string
- func (ent *Stop) UpdateKeys(emap *EntityMap) error
- type StopTime
- func (ent *StopTime) AddError(err error)
- func (ent *StopTime) AddWarning(err error)
- func (ent *StopTime) EntityID() string
- func (ent *StopTime) Errors() []error
- func (ent *StopTime) Extra() map[string]string
- func (ent *StopTime) Filename() string
- func (ent *StopTime) GetString(key string) (string, error)
- func (ent *StopTime) SetExtra(key string, value string)
- func (ent *StopTime) SetFeedVersionID(fvid int)
- func (ent *StopTime) SetString(key, value string) error
- func (ent *StopTime) TableName() string
- func (ent *StopTime) UpdateKeys(emap *EntityMap) error
- func (ent *StopTime) Warnings() []error
- type String
- type Tags
- func (r *Tags) Get(k string) (string, bool)
- func (r *Tags) Keys() []string
- func (r Tags) MarshalGQL(w io.Writer)
- func (r *Tags) MarshalJSON() ([]byte, error)
- func (r *Tags) Scan(value interface{}) error
- func (r *Tags) Set(k, v string)
- func (r *Tags) UnmarshalGQL(v interface{}) error
- func (r *Tags) UnmarshalJSON(v []byte) error
- func (r Tags) Value() (driver.Value, error)
- type Time
- type Timestamps
- type Transfer
- type Translation
- type Trip
- type WideTime
- type Writer
Constants ¶
This section is empty.
Variables ¶
var GTFSRTVERSION = "99fdfba627451d2861346c631af84535fa1e02fb"
GTFSRTVERSION is the commit for the gtfs-realtime.proto file.
var GTFSVERSION = "2e6887ea16b689d8ebc70ad334ac8abb2f94a66e"
GTFSVERSION is the commit for the spec reference.md file.
var VERSION = "v0.10.2"
VERSION is the current software version.
Functions ¶
func SecondsToString ¶
SecondsToString takes seconds-since-midnight and returns a GTFS-style time.
func StringToSeconds ¶
StringToSeconds parses a GTFS-style time and returns seconds since midnight.
func ValidateShapes ¶
ValidateShapes returns errors for an array of shapes.
func ValidateStopTimes ¶
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
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 BaseEntity ¶
type BaseEntity struct {
MinEntity
DatabaseEntity
FeedVersionEntity
Timestamps
}
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
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
Date is a nullable date, but can scan strings
func (Date) MarshalGQL ¶ added in v0.10.1
MarshalGQL implements the graphql.Marshaler interface
func (*Date) MarshalJSON ¶ added in v0.10.1
MarshalJSON implements the json.Marshaler interface
func (*Date) UnmarshalGQL ¶ added in v0.10.1
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Date) UnmarshalJSON ¶ added in v0.10.1
UnmarshalJSON implements the json.Marshaler interface
type Entity ¶
type Entity interface {
EntityID() string
Filename() string
Errors() []error
Warnings() []error
AddError(error)
AddWarning(error)
SetExtra(string, string)
Extra() map[string]string
UpdateKeys(*EntityMap) error
}
Entity provides an interface for GTFS entities.
type EntityError ¶
type EntityError interface {
Error() string
}
EntityError is an interface for GTFS Errors
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.
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 FareRule ¶
type FareRule struct {
FareID string `csv:",required"`
RouteID Key
OriginID string
DestinationID string
ContainsID string
BaseEntity
}
FareRule fare_rules.txt
func (*FareRule) UpdateKeys ¶
UpdateKeys updates Entity references.
type Feed ¶
type Feed struct {
ID int `json:"-"`
FeedID string `json:"id" db:"onestop_id"`
Name String `json:"name,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) MatchSecrets ¶ added in v0.10.1
type FeedAssociatedFeeds ¶
type FeedAssociatedFeeds []string
FeedAssociatedFeeds .
func (*FeedAssociatedFeeds) Scan ¶
func (a *FeedAssociatedFeeds) Scan(value interface{}) error
Scan .
type FeedAuthorization ¶
type FeedAuthorization struct {
Type string `json:"type,omitempty"` // ["header", "basic_auth", "query_param", "path_segment"]
ParamName string `json:"param_name,omitempty"`
InfoURL string `json:"info_url,omitempty"`
}
FeedAuthorization contains details about how to access a Feed.
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
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"`
AttributionText string `json:"attribution_text,omitempty"`
AttributionInstructions string `json:"attribution_instructions,omitempty"`
}
FeedLicense describes the license and usage information for a Feed.
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.
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
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) 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) 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
func (Float) MarshalGQL ¶ added in v0.10.1
MarshalGQL implements the graphql.Marshaler interface
func (*Float) MarshalJSON ¶ added in v0.10.1
MarshalJSON implements the json.Marshaler interface
func (*Float) UnmarshalGQL ¶ added in v0.10.1
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Float) UnmarshalJSON ¶ added in v0.10.1
UnmarshalJSON implements the json.marshaler interface.
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) RepeatCount ¶ added in v0.7.1
RepeatCount returns the number of times this trip will be repeated.
func (*Frequency) UpdateKeys ¶
UpdateKeys updates Entity references.
type Geometry ¶ added in v0.8.0
Geometry is an EWKB/GeoJSON wrapper for arbitary geometry.
func (Geometry) MarshalGQL ¶ added in v0.8.0
MarshalGQL implements the graphql.Marshaler interface
func (*Geometry) MarshalJSON ¶ added in v0.8.0
MarshalJSON implements the json.Marshaler interface
func (*Geometry) UnmarshalGQL ¶ added in v0.8.0
UnmarshalGQL implements the graphql.Unmarshaler interface
type Int ¶ added in v0.10.1
func (Int) MarshalGQL ¶ added in v0.10.1
MarshalGQL implements the graphql.Marshaler interface
func (*Int) MarshalJSON ¶ added in v0.10.1
MarshalJSON implements the json.Marshaler interface
func (*Int) UnmarshalGQL ¶ added in v0.10.1
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Int) UnmarshalJSON ¶ added in v0.10.1
UnmarshalJSON implements the json.marshaler interface.
type Key ¶ added in v0.10.1
Key is a nullable foreign key constraint, similar to sql.NullString
func (Key) MarshalGQL ¶ added in v0.10.1
MarshalGQL implements the graphql.Marshaler interface
func (*Key) MarshalJSON ¶ added in v0.10.1
MarshalJSON implements the json.Marshaler interface
func (*Key) UnmarshalGQL ¶ added in v0.10.1
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Key) UnmarshalJSON ¶ added in v0.10.1
UnmarshalJSON implements the json.marshaler interface.
type Level ¶
type Level struct {
LevelID string `csv:",required"`
LevelIndex float64 `csv:",required"`
LevelName string `csv:"level_name"`
BaseEntity
}
Level levels.txt
type LineString ¶
type LineString struct {
Valid bool
geom.LineString
}
LineString is an EWKB/SL encoded LineString
func NewLineStringFromFlatCoords ¶
func NewLineStringFromFlatCoords(coords []float64) LineString
NewLineStringFromFlatCoords returns a new LineString from flat (3) coordinates
func (LineString) MarshalGQL ¶ added in v0.7.2
func (g LineString) MarshalGQL(w io.Writer)
MarshalGQL implements the graphql.Marshaler interface
func (*LineString) MarshalJSON ¶ added in v0.8.0
func (g *LineString) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface
func (LineString) String ¶ added in v0.8.8
func (g LineString) String() string
String returns the GeoJSON representation
func (*LineString) UnmarshalGQL ¶ added in v0.7.2
func (g *LineString) UnmarshalGQL(v interface{}) error
UnmarshalGQL implements the graphql.Unmarshaler interface
type MinEntity ¶ added in v0.8.8
type MinEntity struct {
// contains filtered or unexported fields
}
MinEntity provides default methods.
func (*MinEntity) AddError ¶ added in v0.8.8
AddError adds a loading error to the entity, e.g. from a CSV parse failure
func (*MinEntity) AddWarning ¶ added in v0.8.8
AddWarning .
func (*MinEntity) SetExtra ¶ added in v0.8.8
SetExtra adds a string key, value pair to the entity's extra fields.
func (*MinEntity) UpdateKeys ¶ added in v0.8.8
UpdateKeys updates entity referencespdates foreign keys based on an EntityMap.
type NullWriter ¶ added in v0.8.5
type NullWriter struct {
}
NullWriter is a no-op writer.
func (*NullWriter) AddEntities ¶ added in v0.8.5
func (*NullWriter) AddEntities(ents []Entity) ([]string, error)
func (*NullWriter) AddEntity ¶ added in v0.8.5
func (*NullWriter) AddEntity(ent Entity) (string, error)
func (*NullWriter) Close ¶ added in v0.8.5
func (*NullWriter) Close() error
func (*NullWriter) Create ¶ added in v0.8.5
func (*NullWriter) Create() error
func (*NullWriter) Delete ¶ added in v0.8.5
func (*NullWriter) Delete() error
func (*NullWriter) NewReader ¶ added in v0.8.5
func (*NullWriter) NewReader() (Reader, error)
func (*NullWriter) Open ¶ added in v0.8.5
func (*NullWriter) Open() error
func (*NullWriter) String ¶ added in v0.10.1
func (*NullWriter) String() string
type Operator ¶ added in v0.8.5
type Operator struct {
ID int `json:"-"`
OnestopID String `json:"onestop_id"`
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:"-"`
}
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
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) UpdateKeys ¶
UpdateKeys updates Entity references.
type Point ¶
Point is an EWKB/SL encoded point
func (Point) MarshalGQL ¶ added in v0.7.2
MarshalGQL implements the graphql.Marshaler interface
func (*Point) MarshalJSON ¶ added in v0.8.0
MarshalJSON implements the json.Marshaler interface
func (*Point) UnmarshalGQL ¶ added in v0.7.2
UnmarshalGQL implements the graphql.Unmarshaler interface
type Polygon ¶ added in v0.7.2
Polygon is an EWKB/SL encoded Polygon
func (Polygon) MarshalGQL ¶ added in v0.7.2
MarshalGQL implements the graphql.Marshaler interface
func (*Polygon) MarshalJSON ¶ added in v0.8.0
MarshalJSON implements the json.Marshaler interface
func (*Polygon) UnmarshalGQL ¶ added in v0.7.2
UnmarshalGQL implements the graphql.Unmarshaler interface
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
}
Reader defines an interface for reading entities from a GTFS feed.
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
Geometry Geometry `csv:"-" db:"-"`
NetworkID string `db:"-"`
AsRoute int `db:"-"`
BaseEntity
}
Route routes.txt
func (*Route) UpdateKeys ¶
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"`
}
Secret .
func (Secret) MatchFilename ¶ added in v0.10.1
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 ¶
NewServicesFromReader returns
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) GetWeekday ¶ added in v0.8.0
GetWeekday returns the value fo the day of week.
func (*Service) HasAtLeastOneDay ¶ added in v0.8.0
HasAtLeastOneDay checks if the Service is active for at least one day.
func (*Service) Reset ¶ added in v0.8.8
func (s *Service) Reset()
Reset resets calendars, except ServiceID
func (*Service) ServicePeriod ¶
ServicePeriod returns the widest possible range of days with transit service, including service exceptions.
func (*Service) SetWeekday ¶ added in v0.8.0
SetWeekday sets the day of week.
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 ¶
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.
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"`
AreaID string `db:"-"`
BaseEntity
}
Stop stops.txt
func (*Stop) Coordinates ¶
Coordinates returns the stop lon,lat as a [2]float64
func (*Stop) SetCoordinates ¶
SetCoordinates takes a [2]float64 and sets the Stop's lon,lat
func (*Stop) UpdateKeys ¶
UpdateKeys updates Entity references.
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
FeedVersionID int `csv:"-"`
// contains filtered or unexported fields
}
StopTime stop_times.txt
func (*StopTime) AddError ¶ added in v0.7.1
AddError adds a loading error to the entity, e.g. from a CSV parse failure
func (*StopTime) AddWarning ¶ added in v0.7.1
AddWarning .
func (*StopTime) SetExtra ¶ added in v0.7.1
SetExtra adds a string key, value pair to the entity's extra fields.
func (*StopTime) SetFeedVersionID ¶ added in v0.7.1
SetFeedVersionID sets the Entity's FeedVersionID.
func (*StopTime) UpdateKeys ¶
UpdateKeys updates Entity references.
type String ¶ added in v0.10.1
func NewOString ¶ added in v0.8.0
func (String) MarshalGQL ¶ added in v0.10.1
MarshalGQL implements the graphql.Marshaler interface
func (*String) MarshalJSON ¶ added in v0.10.1
MarshalJSON implements the json.marshaler interface.
func (*String) UnmarshalGQL ¶ added in v0.10.1
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*String) UnmarshalJSON ¶ added in v0.10.1
UnmarshalJSON implements json.Marshaler interface.
type Tags ¶ added in v0.8.5
type Tags struct {
// contains filtered or unexported fields
}
Tags is a map[string]string with json and gql marshal support. This is a struct instead of bare map[string]string because of a gqlgen issue.
func (Tags) MarshalGQL ¶ added in v0.8.5
MarshalGQL implements the graphql.Marshaler interface
func (*Tags) MarshalJSON ¶ added in v0.8.5
MarshalJSON implements the json.marshaler interface.
func (*Tags) UnmarshalGQL ¶ added in v0.8.5
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Tags) UnmarshalJSON ¶ added in v0.8.5
UnmarshalJSON implements json.Marshaler interface.
type Time ¶ added in v0.10.1
Time is a nullable date without time component
func (Time) MarshalGQL ¶ added in v0.10.1
MarshalGQL implements the graphql.Marshaler interface
func (*Time) MarshalJSON ¶ added in v0.10.1
MarshalJSON implements the json.Marshaler interface
func (*Time) UnmarshalGQL ¶ added in v0.10.1
UnmarshalGQL implements the graphql.Unmarshaler interface
type Timestamps ¶
Timestamps .
func (*Timestamps) UpdateTimestamps ¶
func (ent *Timestamps) UpdateTimestamps()
UpdateTimestamps initializes or updates CreatedAt / UpdatedAt
type Transfer ¶
type Transfer struct {
FromStopID string `csv:",required" required:"true"`
ToStopID string `csv:",required" required:"true"`
TransferType int
MinTransferTime Int
BaseEntity
}
Transfer transfers.txt
func (*Transfer) UpdateKeys ¶
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) UpdateKeys ¶
UpdateKeys updates Entity references.
type WideTime ¶
WideTime handles seconds since midnight, allows >24 hours.
func NewWideTime ¶
NewWideTime converts the csv string to a WideTime.
func NewWideTimeFromSeconds ¶ added in v0.8.0
NewWideTimeFromSeconds creates a valid WideTime from Seconds.
func (WideTime) MarshalGQL ¶ added in v0.7.2
MarshalGQL implements the graphql.Marshaler interface
func (*WideTime) UnmarshalGQL ¶ added in v0.7.2
UnmarshalGQL implements the graphql.Unmarshaler interface
Source Files
¶
- entitymap.go
- feed.go
- feed_version.go
- geom.go
- gtfs_agency.go
- gtfs_attribution.go
- gtfs_calendar.go
- gtfs_calendar_date.go
- gtfs_entity.go
- gtfs_fare_attribute.go
- gtfs_fare_rule.go
- gtfs_feed_info.go
- gtfs_frequency.go
- gtfs_level.go
- gtfs_pathway.go
- gtfs_route.go
- gtfs_shape.go
- gtfs_stop.go
- gtfs_stop_time.go
- gtfs_transfer.go
- gtfs_translation.go
- gtfs_trip.go
- nullwriter.go
- operator.go
- reader.go
- secret.go
- service.go
- tl.go
- types.go
- widetime.go
- writer.go