aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/database_models.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-15 21:18:01 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-15 21:18:01 -0700
commit6e96f5e6e409f2bf2c389c7315f0747ab9e24d00 (patch)
tree7f866c38eb5f8a257da9e255029032f6b173c1d3 /rust/src/database_models.rs
parent0ed087be71b02d9279bd3b131131eae672580d71 (diff)
downloadfatcat-6e96f5e6e409f2bf2c389c7315f0747ab9e24d00.tar.gz
fatcat-6e96f5e6e409f2bf2c389c7315f0747ab9e24d00.zip
fmt
Diffstat (limited to 'rust/src/database_models.rs')
-rw-r--r--rust/src/database_models.rs30
1 files changed, 21 insertions, 9 deletions
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index e95e5980..0995304f 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -1,16 +1,14 @@
-
use chrono;
//use serde_json;
-use uuid::Uuid;
use database_schema::*;
+use uuid::Uuid;
// Ugh. I thought the whole point was to *not* do this, but:
// https://github.com/diesel-rs/diesel/issues/1589
// Helper for constructing tables
macro_rules! entity_structs {
- ($edit_table:expr, $edit_struct:ident, $ident_table:expr, $ident_struct:ident) => (
-
+ ($edit_table:expr, $edit_struct:ident, $ident_table:expr, $ident_struct:ident) => {
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset, QueryableByName)]
#[table_name = $edit_table]
pub struct $edit_struct {
@@ -30,7 +28,7 @@ macro_rules! entity_structs {
pub rev_id: Option<i64>,
pub redirect_id: Option<Uuid>,
}
- )
+ };
}
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
@@ -44,7 +42,12 @@ pub struct ContainerRevRow {
pub issn: Option<String>,
}
-entity_structs!("container_edit", ContainerEditRow, "container_ident", ContainerIdentRow);
+entity_structs!(
+ "container_edit",
+ ContainerEditRow,
+ "container_ident",
+ ContainerIdentRow
+);
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
#[table_name = "creator_rev"]
@@ -55,7 +58,12 @@ pub struct CreatorRevRow {
pub orcid: Option<String>,
}
-entity_structs!("creator_edit", CreatorEditRow, "creator_ident", CreatorIdentRow);
+entity_structs!(
+ "creator_edit",
+ CreatorEditRow,
+ "creator_ident",
+ CreatorIdentRow
+);
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
#[table_name = "file_rev"]
@@ -86,7 +94,12 @@ pub struct ReleaseRevRow {
pub issue: Option<String>,
}
-entity_structs!("release_edit", ReleaseEditRow, "release_ident", ReleaseIdentRow);
+entity_structs!(
+ "release_edit",
+ ReleaseEditRow,
+ "release_ident",
+ ReleaseIdentRow
+);
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
#[table_name = "work_rev"]
@@ -109,7 +122,6 @@ pub struct ReleaseContribRow {
contrib_type: Option<String>,
}
-
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
#[table_name = "release_ref"]
pub struct ReleaseRefRow {