-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.rs
More file actions
61 lines (55 loc) · 1.25 KB
/
Copy pathmodels.rs
File metadata and controls
61 lines (55 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::data::schema::addresses;
use crate::data::schema::states;
#[derive(Queryable, Debug)]
pub struct State {
pub id: Uuid,
pub hash: String,
pub version: String,
pub processed_at: NaiveDateTime
}
#[derive(Insertable, Debug)]
#[table_name="states"]
pub struct NewState<'a> {
pub id: Uuid,
pub hash: &'a str,
pub version: &'a str,
pub processed_at: NaiveDateTime
}
#[derive(Serialize, Deserialize, Queryable, Debug)]
pub struct Address {
pub id: Uuid,
pub lat: f64,
pub lon: f64,
pub number: String,
pub street: String,
pub city: String,
pub region: String,
pub postcode: String
}
#[derive(Insertable, Debug)]
#[table_name="addresses"]
pub struct NewAddress<'a> {
pub id: Uuid,
pub lat: f64,
pub lon: f64,
pub number: &'a str,
pub street: &'a str,
pub city: &'a str,
pub region: &'a str,
pub postcode: &'a str
}
// Used as CSV record model
#[derive(Debug, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub struct AddressRecord {
pub lon: f32,
pub lat: f32,
pub number: String,
pub street: String,
pub city: String,
pub region: String,
pub postcode: String
}