just add data loader here
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
This commit is contained in:
parent
04ae29eb27
commit
55df6bdb16
23 changed files with 4097 additions and 1 deletions
23
data_loader/src/traits.rs
Normal file
23
data_loader/src/traits.rs
Normal 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> {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue