dbt

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: GPL-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package dbt (short for database type) contains the types for data extracted by the database by the dbquery package.

Isolation provides more clarity that the types in this dbt package can be used independently of dbquery itself. For example the csa package utilizes this dbt package; but the tests themsleves for CSA don't involve the db at all.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalToService

type CalToService struct {
	FeedID      int    `db:"feed_id"`
	ServiceDate int    `db:"service_date"`
	ServiceID   string `db:"service_id"`
}

CalToService maps a given service_date to a service_id for a feed_id. This is a direct representiation of a row from _vcaltoservice.

type Connection

type Connection struct {
	ConnOID int    `db:"oid"`
	TripID  string `db:"trip_id"`

	FromST           int    `db:"from_stop_drutctime"`
	FromStopSequence string `db:"from_stop_sequence"`
	FromStopUID      string `db:"from_stop_parent_uid"`

	ToStopUID      string `db:"to_stop_parent_uid"`
	ToStopSequence string `db:"to_stop_sequence"`
	ToST           int    `db:"to_stop_drutctime"`
}

Connection represents a single connection row from the database. A connection is a pairing of a from & to stop along with times at each. An associated trip_id can be referenced back to the trips table.

type ConnectionVerbose

type ConnectionVerbose struct {
	ConnOID           int     `db:"oid" json:"conn_oid,omitempty"`
	FeedID            int     `db:"feed_id" json:"feed_id,omitempty"`
	ServiceID         string  `db:"service_id" json:"service_id,omitempty"`
	ServiceDate       string  `db:"service_date" json:"service_date,omitempty"`
	FromStopID        string  `db:"from_stop_id" json:"from_stop_id,omitempty"`
	DirectionID       *int    `db:"direction_id" json:"direction_id,omitempty"`
	FromStopSequence  int     `db:"from_stop_sequence" json:"from_stop_sequence,omitempty"`
	FromStopParentID  string  `db:"from_stop_parent_id" json:"from_stop_parent_id,omitempty"`
	FromStopParentUID string  `db:"from_stop_parent_uid" json:"from_stop_parent_uid,omitempty"`
	FromStopLat       float64 `db:"from_stop_lat" json:"from_stop_lat,omitempty"`
	FromStopLon       float64 `db:"from_stop_lon" json:"from_stop_lon,omitempty"`
	FromStopName      string  `db:"from_stop_name" json:"from_stop_name,omitempty"`
	FromStopTime      uint    `db:"from_stop_time" json:"from_stop_time,omitempty"`
	FromStopDRUTCTime int     `db:"from_stop_drutctime" json:"from_stop_drutctime,omitempty"`
	RouteID           string  `db:"route_id" json:"route_id,omitempty"`
	AgencyID          *string `db:"agency_id" json:"agency_id,omitempty"`
	RouteShortName    *string `db:"route_short_name" json:"route_short_name,omitempty"`
	RouteLongName     *string `db:"route_long_name" json:"route_long_name,omitempty"`
	TripID            string  `db:"trip_id" json:"tid,omitempty"`
	ToStopSequence    string  `db:"to_stop_sequence" json:"to_stop_sequence,omitempty"`
	ToStopID          string  `db:"to_stop_id" json:"to_stop_id,omitempty"`
	ToStopParentID    string  `db:"to_stop_parent_id" json:"to_stop_parent_id,omitempty"`
	ToStopParentUID   string  `db:"to_stop_parent_uid" json:"to_stop_parent_uid,omitempty"`
	ToStopLat         float64 `db:"to_stop_lat" json:"to_stop_lat,omitempty"`
	ToStopLon         float64 `db:"to_stop_lon" json:"to_stop_lon,omitempty"`
	ToStopName        string  `db:"to_stop_name" json:"to_stop_name,omitempty"`
	ToStopTime        uint    `db:"to_stop_time" json:"to_stop_time,omitempty"`
	ToStopDRUTCTime   int     `db:"to_stop_drutctime" json:"to_stop_drutctime,omitempty"`
	TripHeadsign      *string `db:"trip_headsign" json:"trip_headsign,omitempty"`

	// For some reason extra oid field passed along in select *; this allows sqlx to not complain
	Ignore int `db:"oid:1" json:"-"`
}

ConnectionVerbose represents a single connection row from the database. It's similar to Connection, however it has extra metadata fields and it is extracted by a somewhat more complex SQL query. This is used in routing finalization to present a more usable form to end users.

type StopToParent

type StopToParent struct {
	FeedID        int    `db:"feed_id"`
	StopID        string `db:"stop_id"`
	ParentStation string `db:"parent_station"`
}

StopToParent maps a given stop_id to its "ultimate" parent for a feed_id. This is a direct representation of a row from _vstopparent.

type StopWalk

type StopWalk struct {
	StopUID  string   `db:"stop_uid" json:"stop_uid"`
	StopName string   `db:"stop_name" json:"stop_name"`
	StopLat  float64  `db:"stop_lat" json:"stop_lat"`
	StopLon  float64  `db:"stop_lon" json:"stop_lon"`
	DistKM   *float64 `db:"dist_km" json:"dist_km"`
}

A stopwalk represents a single abstract 'walk' to get to a stop. This is just a pairing of a distance km with a given stop. Taken independently a 'stop walk' is meaningless, but this is because a stop walk is always produced with a given 'input geocoordinate' reference which if you subtract / haversine that input reference coordinate from the given stop lat/lon you get the set dist KM.

type Transfer

type Transfer struct {
	FromFeedID        int    `db:"from_feed_id"`
	FromStopParentUID string `db:"from_stop_parent_uid"`
	FromStopParentID  string `db:"from_stop_parent_id"`
	FromStopID        string `db:"from_stop_id"`

	ToFeedID        int    `db:"to_feed_id"`
	ToStopParentUID string `db:"to_stop_parent_uid"`
	ToStopParentID  string `db:"to_stop_parent_id"`
	ToStopID        string `db:"to_stop_id"`

	TransferCategory string `db:"transfer_category"`
	TransferSeconds  uint   `db:"transfer_seconds"`
}

Transfer represents a valid transfer from one stop to another and the associated cost in seconds.

Transfer category may be one of:

i: Implicit, e.g. transfer from one stop to another with same 'parent'
t: Table, e.g. sourced from the GTFS origin transfers.txt
g: Generated, e.g. was dynamically calculated by using stop distances
   and assumed walkspeed

Jump to

Keyboard shortcuts

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