Documentation ¶
Index ¶
- func MakeFeedMessage(t time.Time) *gtfsrt.FeedMessage
- func MakeTranslatedString(s string) *gtfsrt.TranslatedString
- func MissingColumnCheck(file string, required []string, row map[string]string) error
- func StringSliceHas(s sort.StringSlice, x string) bool
- func StringSliceInsert(s sort.StringSlice, x string) sort.StringSlice
- func ZipStrings(a []string, b []string) (zipped map[string]string)
- type InvalidGtfsReference
- type MissingColumn
- type RequestError
- type Resource
- type ResourceHTTP
- type ResourceLocal
- type UnexpectedHost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeFeedMessage ¶
func MakeFeedMessage(t time.Time) *gtfsrt.FeedMessage
MakeFeedMessage preapres a GTFS-RT FeedMessage object and adds a valid FeedHeader to it
func MakeTranslatedString ¶
func MakeTranslatedString(s string) *gtfsrt.TranslatedString
MakeTranslatedString takes a string and warps it into a gtfs-realtime TranslatedString object
func MissingColumnCheck ¶
MissingColumnCheck returns nil if all required columns are set in the given row, returns an MissingColumn error otherwise
func StringSliceHas ¶
func StringSliceHas(s sort.StringSlice, x string) bool
StringSliceHas checks if element is inside a StringSlice
func StringSliceInsert ¶
func StringSliceInsert(s sort.StringSlice, x string) sort.StringSlice
StringSliceInsert adds x into sort.StringSlice
Types ¶
type InvalidGtfsReference ¶
type InvalidGtfsReference struct { ReferingFile string Column string Value string ExpectedDefinition string }
InvalidGtfsReference is an error object used when one GTFS file references an non-existant field
func (InvalidGtfsReference) Error ¶
func (e InvalidGtfsReference) Error() string
type MissingColumn ¶
MissingColumn is an error object used when a CSV file is missing a required column
func (MissingColumn) Error ¶
func (e MissingColumn) Error() string
type RequestError ¶
RequestError is an error object used when a server responds with an unexpected return code
func (RequestError) Error ¶
func (e RequestError) Error() string
type Resource ¶
type Resource interface { Check() (bool, error) Fetch() (io.ReadCloser, error) }
Resource interface represents an external, fetchable resource: Check() should check if the resource should be updated, Fetch() fetches the resource.
type ResourceHTTP ¶
type ResourceHTTP struct { Client *http.Client URL string Checktime time.Time Peroid time.Duration FetchedETag string FetchedModified time.Time }
ResourceHTTP is a Resource located on the internet, fetchable via HTTP/HTTPS
func (*ResourceHTTP) Check ¶
func (r *ResourceHTTP) Check() (fetch bool, err error)
Check checks if the file on the internet has changed, but only if more then r.Peroid has passed since r.Fetchtime
func (*ResourceHTTP) Fetch ¶
func (r *ResourceHTTP) Fetch() (io.ReadCloser, error)
Fetch returns the ReadCloser with access to the underlaying file
type ResourceLocal ¶
type ResourceLocal struct { Path string Checktime time.Time Peroid time.Duration FetchedModified time.Time }
ResourceLocal is a Resource located on the file system
func (*ResourceLocal) Check ¶
func (r *ResourceLocal) Check() (fetch bool, err error)
Check checks if the file has changed, but only if more then r.Peroid has passed since r.Fetchtime
func (*ResourceLocal) Fetch ¶
func (r *ResourceLocal) Fetch() (io.ReadCloser, error)
Fetch returns the ReadCloser with access to the underlaying file
type UnexpectedHost ¶
UnexpectedHost is an error object used when a link points to an invalid host
func (UnexpectedHost) Error ¶
func (e UnexpectedHost) Error() string