Documentation ¶
Index ¶
- Variables
- type DataFeedResponse
- type ETAService
- type FeedbackService
- type Form
- type Location
- type LocationService
- type Message
- type MessageService
- type ModelService
- type Point
- type Route
- type RouteActiveInterval
- type RouteSchedule
- type RouteService
- type Stop
- type StopETA
- type StopService
- type UpdaterService
- type User
- type UserService
- type Vehicle
- type VehicleETA
- type VehicleService
Constants ¶
This section is empty.
Variables ¶
var ErrFormNotFound = errors.New("Form not found")
ErrFormNotFound indicates that a Form is not found.
var ( // ErrLocationNotFound indicates that a Location is not in the database. ErrLocationNotFound = errors.New("location not found") )
var ( // ErrMessageNotFound indicates that a Message is not in the database. ErrMessageNotFound = errors.New("message not found") )
var ErrRouteNotFound = errors.New("Route not found")
ErrRouteNotFound indicates that a Route is not in the service.
var ErrStopNotFound = errors.New("Stop not found")
ErrStopNotFound indicates that a Stop is not in the service.
var ErrUserNotFound = errors.New("User not found")
ErrUserNotFound indicates that a User is not in the service.
var ErrVehicleNotFound = errors.New("Vehicle not found")
ErrVehicleNotFound indicates that a Vehicle is not in the service.
Functions ¶
This section is empty.
Types ¶
type DataFeedResponse ¶
DataFeedResponse contains information from the iTRAK data feed.
type ETAService ¶
type ETAService interface { Subscribe(func(VehicleETA)) CurrentETAs() map[int64]VehicleETA }
ETAService is an interface for interacting with vehicle estimated times of arrival.
type FeedbackService ¶
type FeedbackService interface { GetAdminForm() *Form GetForm(id int64) (*Form, error) GetForms() ([]*Form, error) CreateForm(form *Form) error DeleteForm(id int64) error }
FeedbackService is an interface for interacting with Feedback.
type Form ¶
type Form struct { ID int64 `json:"id"` Message string `json:"message"` Prompt string `json:"prompt"` Created time.Time `json:"created"` Admin bool `json:"admin"` }
details of each form
type Location ¶
type Location struct { ID int64 `json:"id"` TrackerID string `json:"tracker_id"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Heading float64 `json:"heading"` Speed float64 `json:"speed"` Time time.Time `json:"time"` Created time.Time `json:"created"` // VehicleID is a pointer to an int64 because it may be null. VehicleID *int64 `json:"vehicle_id"` // RouteID is a pointer to an int64 because it may be null. RouteID *int64 `json:"route_id"` }
Location represents information about a vehicle's location.
type LocationService ¶
type LocationService interface { CreateLocation(location *Location) error DeleteLocationsBefore(before time.Time) (int, error) LocationsSince(vehicleID int64, since time.Time) ([]*Location, error) LatestLocation(vehicleID int64) (*Location, error) LatestLocations() ([]*Location, error) Location(id int64) (*Location, error) SubscribeLocations() chan *Location }
LocationService is an interface for interacting with information about vehicle positions.
type Message ¶
type Message struct { Message string `json:"message"` Enabled bool `json:"enabled"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Link string `json:"link"` }
Message represents a message displayed to users.
type MessageService ¶
MessageService is an interface for interacting with Messages.
type ModelService ¶
type ModelService interface { VehicleService RouteService StopService LocationService }
ModelService is a collection of interfaces related to vehicles, routes, stops, and their locations.
type Route ¶
type Route struct { ID int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` Enabled bool `json:"enabled"` Color string `json:"color"` Width int64 `json:"width"` StopIDs []int64 `json:"stop_ids"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Points []Point `json:"points"` Active bool `json:"active"` Schedule RouteSchedule `json:"schedule"` }
Route represents a set of coordinates to draw a path on our tracking map
type RouteActiveInterval ¶
type RouteActiveInterval struct { ID int64 `json:"id"` RouteID int64 `json:"route_id"` StartDay time.Weekday `json:"start_day"` StartTime time.Time `json:"start_time"` EndDay time.Weekday `json:"end_day"` EndTime time.Time `json:"end_time"` }
RouteActiveInterval represents a time interval during which a Route is active.
type RouteSchedule ¶
type RouteSchedule []RouteActiveInterval
RouteSchedule represents multiple time intervals during which a Route is active.
type RouteService ¶
type RouteService interface { Route(id int64) (*Route, error) Routes() ([]*Route, error) CreateRoute(route *Route) error DeleteRoute(id int64) error ModifyRoute(route *Route) error }
RouteService is an interface for interacting with Routes.
type Stop ¶
type Stop struct { ID int64 `json:"id"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` // Name and Description are pointers because they may be nil. Name *string `json:"name"` Description *string `json:"description"` }
Stop is a place where vehicles frequently stop.
type StopETA ¶
type StopETA struct { StopID int64 `json:"stop_id"` ETA time.Time `json:"eta"` Arriving bool `json:"arriving"` }
StopETA represents a time when a Vehicle is expected to arrive at a Stop.
type StopService ¶
type StopService interface { Stop(id int64) (*Stop, error) Stops() ([]*Stop, error) CreateStop(stop *Stop) error CreateStopWithID(stop *Stop) error DeleteStop(id int64) error }
StopService is an interface for interacting with Stops.
type UpdaterService ¶
type UpdaterService interface {
GetLastResponse() *DataFeedResponse
}
UpdaterService is an interface for interacting with vehicle location updates.
type UserService ¶
type UserService interface { CreateUser(*User) error DeleteUser(username string) error UserExists(username string) (bool, error) Users() ([]*User, error) }
UserService is an interface for interacting with Users.
type Vehicle ¶
type Vehicle struct { ID int64 `json:"id"` Name string `json:"name"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Enabled bool `json:"enabled"` TrackerID string `json:"tracker_id"` }
Vehicle represents an object being tracked.
type VehicleETA ¶
type VehicleETA struct { VehicleID int64 `json:"vehicle_id"` RouteID int64 `json:"route_id"` StopETAs []StopETA `json:"stop_etas"` Updated time.Time `json:"updated"` }
VehicleETA contains information about a Vehicle, its current Route, and its ETAs to Stops.
type VehicleService ¶
type VehicleService interface { Vehicle(id int64) (*Vehicle, error) VehicleWithTrackerID(id string) (*Vehicle, error) Vehicles() ([]*Vehicle, error) EnabledVehicles() ([]*Vehicle, error) CreateVehicle(vehicle *Vehicle) error DeleteVehicle(id int64) error ModifyVehicle(vehicle *Vehicle) error }
VehicleService is an interface for interacting with Vehicles.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
shuttletracker
Package main bundles together all of shuttletracker's subpackages to create, configure, and run the shuttle tracker.
|
Package main bundles together all of shuttletracker's subpackages to create, configure, and run the shuttle tracker. |