podchamp/
models.rs

1
2use {
3    crate::schema::*,
4    chrono::prelude::*,
5};
6
7//struct StoredTimestamp(DateTime<Utc>);
8//
9//impl Into<DateTime<Utc>> for StoredTimestamp {
10//    fn into(self) -> DateTime<Utc> { self.0 }
11//}
12//
13//impl Queryable<S, B> for StoredTimestamp where
14//    B: Backend,
15//    String: Queryable<S, B>
16//{
17//    type Row = <String as Queryable<S, B>>::Row;
18//
19//    fn build(row: Self::Row) -> Self {
20//
21//    }
22//}
23
24#[derive(Queryable)]
25pub struct Feed {
26    pub name:        String,
27    pub uri:         String,
28    pub backlog:     i32,
29    pub fetch_since: Option<NaiveDateTime>,
30}
31
32#[derive(Insertable)]
33#[table_name="feeds"]
34pub struct NewFeed<'a> {
35    pub name:        &'a str,
36    pub uri:         &'a str,
37    pub backlog:     i32,
38    pub fetch_since: Option<NaiveDateTime>,
39}
40
41#[derive(Queryable)]
42pub struct Registration {
43    pub feed: String,
44    pub guid: String,
45}
46
47#[derive(Insertable)]
48#[table_name="register"]
49pub struct NewRegistration<'a> {
50    pub feed: &'a str,
51    pub guid: &'a str,
52}
53