Documentation
¶
Overview ¶
Package dmfr provides tool and utilities for working with DMFR files and database representations of feeds and feed versions.
Index ¶
- type Feed
- type FeedAssociatedFeeds
- type FeedAuthorization
- type FeedFetch
- type FeedLanguages
- type FeedLicense
- type FeedState
- type FeedUrls
- type FeedVersion
- type FeedVersionAgencyOnestopID
- type FeedVersionFileInfo
- type FeedVersionImport
- type FeedVersionRouteOnestopID
- type FeedVersionServiceLevel
- type FeedVersionServiceWindow
- type FeedVersionStopOnestopID
- type FeedVersionTables
- type Operator
- type OperatorAssociatedFeed
- type OperatorAssociatedFeeds
- type RawRegistry
- type RawRegistryFeed
- type Registry
- type Secret
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Feed ¶
type Feed struct { FeedID string `json:"id" db:"onestop_id"` SupersedesIDs tt.Strings `json:"supersedes_ids,omitempty" db:"-"` Name tt.String `json:"name,omitempty"` Description tt.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 tt.Tags `json:"tags,omitempty" db:"feed_tags" ` File string `json:"-"` // internal DeletedAt tt.Time `json:"-"` // internal tt.DatabaseEntity `json:"-"` // internal tt.Timestamps `json:"-"` // internal }
Feed listed in a parsed DMFR file
func (*Feed) MatchSecrets ¶ added in v0.18.0
type FeedAssociatedFeeds ¶ added in v0.18.0
type FeedAssociatedFeeds []string
FeedAssociatedFeeds .
func (*FeedAssociatedFeeds) Scan ¶ added in v0.18.0
func (a *FeedAssociatedFeeds) Scan(value interface{}) error
Scan .
type FeedAuthorization ¶ added in v0.18.0
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 ¶ added in v0.18.0
func (a *FeedAuthorization) Scan(value interface{}) error
Scan .
type FeedFetch ¶ added in v0.10.1
type FeedFetch struct { FeedID int URLType string URL string Success bool FetchedAt tt.Time FetchError tt.String ResponseSize tt.Int ResponseCode tt.Int ResponseSHA1 tt.String FeedVersionID tt.Int // optional field, don't use FeedVersionEntity tt.Timestamps tt.DatabaseEntity }
FeedFetch is a record of when feed data was fetched via a URL
type FeedLanguages ¶
type FeedLanguages []string
FeedLanguages .
func (*FeedLanguages) Scan ¶ added in v0.18.0
func (a *FeedLanguages) Scan(value interface{}) error
Scan .
type FeedLicense ¶ added in v0.18.0
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.
func (*FeedLicense) Scan ¶ added in v0.18.0
func (a *FeedLicense) Scan(value interface{}) error
Scan .
type FeedState ¶
type FeedState struct { FeedID int FeedVersionID tt.Int FeedPriority tt.Int FetchWait tt.Int FeedRealtimeEnabled bool Public bool tt.DatabaseEntity tt.Timestamps }
FeedState stores a pointer to the active FeedVersion and values that control feed fetch and permissions.
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 ¶ added in v0.18.0
type FeedVersion struct { FeedID int SHA1 string SHA1Dir string File string URL string EarliestCalendarDate tt.Date LatestCalendarDate tt.Date FetchedAt time.Time Fragment tt.String Name tt.String Description tt.String CreatedBy tt.String UpdatedBy tt.String tt.DatabaseEntity tt.Timestamps }
FeedVersion represents a single version of a GTFS data source.
func (*FeedVersion) EntityID ¶ added in v0.18.0
func (ent *FeedVersion) EntityID() string
EntityID .
func (*FeedVersion) TableName ¶ added in v0.18.0
func (ent *FeedVersion) TableName() string
TableName sets the table name prefix.
type FeedVersionAgencyOnestopID ¶ added in v0.18.0
type FeedVersionAgencyOnestopID struct { EntityID string OnestopID string tt.FeedVersionEntity }
func (FeedVersionAgencyOnestopID) TableName ¶ added in v0.18.0
func (ent FeedVersionAgencyOnestopID) TableName() string
type FeedVersionFileInfo ¶
type FeedVersionFileInfo struct { Name string Size int64 Rows int64 Columns int Header string CSVLike bool SHA1 string ValuesUnique tt.Counts ValuesCount tt.Counts tt.FeedVersionEntity tt.DatabaseEntity tt.Timestamps }
FeedVersionFileInfo describes the individual files in a static GTFS feed
type FeedVersionImport ¶
type FeedVersionImport struct { ImportLog string ExceptionLog string ImportLevel int // deprecated Success bool // Finished, Success Yes/No InProgress bool // In Progress ScheduleRemoved bool // Stop times and trips have been uimported InterpolatedStopTimeCount int EntityCount tt.Counts WarningCount tt.Counts GeneratedCount tt.Counts SkipEntityErrorCount tt.Counts SkipEntityReferenceCount tt.Counts SkipEntityFilterCount tt.Counts SkipEntityMarkedCount tt.Counts tt.DatabaseEntity tt.FeedVersionEntity tt.Timestamps }
FeedVersionImport is a record of when a feed version was imported into the database.
func NewFeedVersionImport ¶ added in v0.8.0
func NewFeedVersionImport() *FeedVersionImport
NewFeedVersionImport returns an initialized FeedVersionImport.
type FeedVersionRouteOnestopID ¶ added in v0.18.0
type FeedVersionRouteOnestopID struct { EntityID string OnestopID string tt.FeedVersionEntity }
func (FeedVersionRouteOnestopID) TableName ¶ added in v0.18.0
func (ent FeedVersionRouteOnestopID) TableName() string
type FeedVersionServiceLevel ¶ added in v0.7.1
type FeedVersionServiceLevel struct { StartDate tt.Date EndDate tt.Date Monday int Tuesday int Wednesday int Thursday int Friday int Saturday int Sunday int tt.FeedVersionEntity tt.DatabaseEntity }
FeedVersionServiceLevel is a cached summary of the number of seconds of scheduled service for a GTFS feed on a week-by-week basis.
func (*FeedVersionServiceLevel) EntityID ¶ added in v0.7.1
func (fvi *FeedVersionServiceLevel) EntityID() string
EntityID .
func (FeedVersionServiceLevel) TableName ¶ added in v0.7.1
func (FeedVersionServiceLevel) TableName() string
TableName .
func (*FeedVersionServiceLevel) Total ¶ added in v0.12.0
func (fvsl *FeedVersionServiceLevel) Total() int
type FeedVersionServiceWindow ¶ added in v0.12.0
type FeedVersionServiceWindow struct { FeedStartDate tt.Date FeedEndDate tt.Date EarliestCalendarDate tt.Date LatestCalendarDate tt.Date FallbackWeek tt.Date DefaultTimezone tt.String tt.FeedVersionEntity tt.DatabaseEntity tt.Timestamps }
FeedVersionServiceWindow is a cached summary of the overall start and end dates for a feed version, sourced from feed_info.txt and calendar.txt.
func (*FeedVersionServiceWindow) EntityID ¶ added in v0.12.0
func (fvi *FeedVersionServiceWindow) EntityID() string
func (FeedVersionServiceWindow) TableName ¶ added in v0.12.0
func (FeedVersionServiceWindow) TableName() string
type FeedVersionStopOnestopID ¶ added in v0.18.0
type FeedVersionStopOnestopID struct { EntityID string OnestopID string tt.FeedVersionEntity }
func (FeedVersionStopOnestopID) TableName ¶ added in v0.18.0
func (ent FeedVersionStopOnestopID) TableName() string
type FeedVersionTables ¶ added in v0.18.0
type FeedVersionTables struct { FetchStatDerivedTables []string ImportDerivedTables []string SystemTables []string GtfsAnonTables []string GtfsEntityTables []string GtfsExtTables []string }
func GetFeedVersionTables ¶ added in v0.18.0
func GetFeedVersionTables() FeedVersionTables
func (FeedVersionTables) AllTables ¶ added in v0.18.0
func (t FeedVersionTables) AllTables() []string
func (FeedVersionTables) ImportedTables ¶ added in v0.18.0
func (t FeedVersionTables) ImportedTables() []string
func (FeedVersionTables) ScheduleTables ¶ added in v0.18.0
func (t FeedVersionTables) ScheduleTables() []string
type Operator ¶ added in v0.18.0
type Operator struct { OnestopID tt.String `json:"onestop_id"` SupersedesIDs tt.Strings `json:"supersedes_ids,omitempty" db:"-"` Name tt.String `json:"name,omitempty"` ShortName tt.String `json:"short_name,omitempty"` Website tt.String `json:"website,omitempty"` AssociatedFeeds OperatorAssociatedFeeds `json:"associated_feeds,omitempty"` Tags tt.Tags `json:"tags,omitempty" db:"operator_tags"` File tt.String `json:"-"` // internal DeletedAt tt.Time `json:"-"` // internal tt.DatabaseEntity `json:"-"` tt.Timestamps `json:"-"` }
type OperatorAssociatedFeed ¶ added in v0.18.0
type OperatorAssociatedFeed struct { GtfsAgencyID tt.String `json:"gtfs_agency_id,omitempty" db:"gtfs_agency_id"` FeedOnestopID tt.String `json:"feed_onestop_id,omitempty" db:"-"` ResolvedOnestopID tt.String `json:"-"` // internal ResolvedGtfsAgencyID tt.String `json:"-"` // internal ResolvedName tt.String `json:"-"` // internal ResolvedShortName tt.String `json:"-"` // internal ResolvedPlaces tt.String `json:"-"` // internal OperatorID tt.Int `json:"-"` // internal FeedID int `json:"-"` // internal tt.DatabaseEntity `json:"-"` // internal }
func (OperatorAssociatedFeed) TableName ¶ added in v0.18.0
func (o OperatorAssociatedFeed) TableName() string
type OperatorAssociatedFeeds ¶ added in v0.18.0
type OperatorAssociatedFeeds []OperatorAssociatedFeed
OperatorAssociatedFeeds is necessary to scan correctly from database
func (OperatorAssociatedFeeds) MarshalGQL ¶ added in v0.18.0
func (r OperatorAssociatedFeeds) MarshalGQL(w io.Writer)
MarshalGQL implements the graphql.Marshaler interface
func (*OperatorAssociatedFeeds) Scan ¶ added in v0.18.0
func (a *OperatorAssociatedFeeds) Scan(value interface{}) error
Scan .
func (*OperatorAssociatedFeeds) UnmarshalGQL ¶ added in v0.18.0
func (r *OperatorAssociatedFeeds) UnmarshalGQL(v interface{}) error
UnmarshalGQL implements the graphql.Unmarshaler interface
type RawRegistry ¶ added in v0.10.1
type RawRegistry struct { Schema string `json:"$schema,omitempty"` Feeds []RawRegistryFeed `json:"feeds,omitempty"` Operators []Operator `json:"operators,omitempty"` Secrets []Secret `json:"secrets,omitempty"` LicenseSpdxIdentifier string `json:"license_spdx_identifier,omitempty"` }
func ReadRawRegistry ¶ added in v0.10.1
func ReadRawRegistry(reader io.Reader) (*RawRegistry, error)
type RawRegistryFeed ¶ added in v0.10.1
feed.Operators should be loaded but not exported
type Registry ¶
type Registry struct { Schema string `json:"$schema,omitempty"` Feeds []Feed `json:"feeds,omitempty"` Operators []Operator `json:"operators,omitempty"` Secrets []Secret `json:"secrets,omitempty"` LicenseSpdxIdentifier string `json:"license_spdx_identifier,omitempty"` }
Registry represents a parsed Distributed Mobility Feed Registry (DMFR) file
func LoadAndParseRegistry ¶
LoadAndParseRegistry loads and parses a Distributed Mobility Feed Registry (DMFR) file from either a file system path or a URL
func ReadRegistry ¶ added in v0.10.1
ReadRegistry TODO
type Secret ¶
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) MatchFilename ¶ added in v0.18.0
MatchFilename finds secrets associated with a DMFR filename.