init commit
This commit is contained in:
parent
d4b364716f
commit
4466021f07
18 changed files with 4734 additions and 2 deletions
1
libseptastic/.gitignore
vendored
Normal file
1
libseptastic/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
target/
|
1583
libseptastic/Cargo.lock
generated
Normal file
1583
libseptastic/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
7
libseptastic/Cargo.toml
Normal file
7
libseptastic/Cargo.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "libseptastic"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
sqlx = "0.8.6"
|
5
libseptastic/src/lib.rs
Normal file
5
libseptastic/src/lib.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
pub mod route;
|
||||
pub mod stop;
|
||||
pub mod route_stop;
|
||||
pub mod stop_schedule;
|
||||
pub mod schedule_day;
|
41
libseptastic/src/route.rs
Normal file
41
libseptastic/src/route.rs
Normal file
|
@ -0,0 +1,41 @@
|
|||
#[derive(sqlx::Type, PartialEq, Debug, Clone)]
|
||||
#[sqlx(type_name = "septa_route_type", rename_all = "snake_case")]
|
||||
pub enum RouteType {
|
||||
Trolley,
|
||||
SubwayElevated,
|
||||
RegionalRail,
|
||||
Bus,
|
||||
TracklessTrolley
|
||||
}
|
||||
|
||||
#[derive(sqlx::Type, PartialEq, Debug, Clone)]
|
||||
#[sqlx(type_name = "septa_direction_type", rename_all = "snake_case")]
|
||||
pub enum CardinalDirection {
|
||||
Northbound,
|
||||
Southbound,
|
||||
Eastbound,
|
||||
Westbound // (and down)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Directional {
|
||||
pub direction: CardinalDirection,
|
||||
pub direction_destination: String
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RouteDirectional {
|
||||
pub primary: Directional, // 0
|
||||
pub secondary: Directional, // 1
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Route {
|
||||
pub name: String,
|
||||
pub short_name: String,
|
||||
pub color_hex: String,
|
||||
pub route_type: RouteType,
|
||||
pub id: String,
|
||||
pub directional: RouteDirectional
|
||||
}
|
9
libseptastic/src/route_stop.rs
Normal file
9
libseptastic/src/route_stop.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
use super::route::CardinalDirection;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RouteStop {
|
||||
pub route_id: String,
|
||||
pub stop_id: i64,
|
||||
pub direction: CardinalDirection,
|
||||
pub stop_sequence: i64
|
||||
}
|
5
libseptastic/src/schedule_day.rs
Normal file
5
libseptastic/src/schedule_day.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct ScheduleDay {
|
||||
pub date: String,
|
||||
pub service_id: String
|
||||
}
|
16
libseptastic/src/stop.rs
Normal file
16
libseptastic/src/stop.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
#[derive(sqlx::Type, PartialEq, Debug, Clone)]
|
||||
#[sqlx(type_name = "septa_stop_type", rename_all = "snake_case")]
|
||||
pub enum StopType {
|
||||
FarSide,
|
||||
MiddleBlockNearSide,
|
||||
Normal
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Stop {
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
pub lat: f64,
|
||||
pub lng: f64,
|
||||
pub stop_type: StopType
|
||||
}
|
12
libseptastic/src/stop_schedule.rs
Normal file
12
libseptastic/src/stop_schedule.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use super::route::CardinalDirection;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct StopSchedule {
|
||||
pub route_id: String,
|
||||
pub trip_id: String,
|
||||
pub service_id: String,
|
||||
pub direction: CardinalDirection,
|
||||
pub arrival_time: i64,
|
||||
pub stop_id: i64,
|
||||
pub stop_sequence: i64
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue