just add data loader here
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled

This commit is contained in:
Nicholas Orlowsky 2025-09-12 19:34:35 -04:00
parent 04ae29eb27
commit 55df6bdb16
No known key found for this signature in database
GPG key ID: A9F3BA4C0AA7A70B
23 changed files with 4097 additions and 1 deletions

23
data_loader/src/traits.rs Normal file
View file

@ -0,0 +1,23 @@
use std::collections::HashMap;
use sqlx::{Postgres, Transaction};
pub trait SeptaJson {}
pub trait FromSeptaJson<T: SeptaJson> {
fn from_septa_json(septa_json: T) -> ::anyhow::Result<Box<Self>>;
}
pub trait FromSeptaJsonAndStations<T: SeptaJson> {
fn from_septa_json(septa_json: T, stop_map: &HashMap<String, i64>) -> ::anyhow::Result<Box<Self>>;
}
pub trait DbObj<T> {
fn create_table(tx: &mut Transaction<'_, Postgres>) -> impl std::future::Future< Output = ::anyhow::Result<()>> + Send;
fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> impl std::future::Future< Output = ::anyhow::Result<()>> + Send;
fn insert_many(s: Vec<T>, tx: &mut Transaction<'_, Postgres>) -> impl std::future::Future< Output = ::anyhow::Result<()>> + Send;
}
pub trait Fetchable<T: SeptaJson> {}