summaryrefslogtreecommitdiff
path: root/rust/scraper/src/database/mod.rs
blob: 232f42f5cea621064056e03586871c59bcaecf86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
pub mod postgres;
pub mod error;

pub use error::DatabaseError;

use proto::touchpad::common::v1;

type Result<T> = std::result::Result<T, DatabaseError>;

#[async_trait::async_trait]
pub trait DatabaseClient {
    async fn get_swimmer(&self, id: u32) -> Result<v1::Swimmer>;
    async fn add_swimmer(&self, swimmer: &v1::Swimmer) -> Result<()>;

    async fn get_team(&self, id: u32) -> Result<v1::Team>;
    async fn add_team(&self, team: &v1::Team) -> Result<()>;

    async fn get_meet(&self, id: u32) -> Result<v1::SwimMeet>;
    async fn add_meet(&self, meet: &v1::SwimMeet) -> Result<()>;
}