summaryrefslogtreecommitdiffstats
path: root/rust/src/bin/show_creators.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/bin/show_creators.rs')
-rw-r--r--rust/src/bin/show_creators.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/rust/src/bin/show_creators.rs b/rust/src/bin/show_creators.rs
new file mode 100644
index 00000000..160ca3c7
--- /dev/null
+++ b/rust/src/bin/show_creators.rs
@@ -0,0 +1,24 @@
+
+extern crate fc;
+extern crate diesel;
+
+use self::fatcat_rs::*;
+use self::models::*;
+use self::diesel::prelude::*;
+
+fn main() {
+ use diesel_demo::schema::creators::dsl::*;
+
+ let connection = establish_connection();
+ let results = creators.filter(published.eq(true))
+ .limit(5)
+ .load::<CreatorRev>(&connection)
+ .expect("Error loading creators");
+
+ println!("Displaying {} creators", results.len());
+ for creator in results {
+ println!("{}", creator.title);
+ println!("----------\n");
+ println!("{}", creator.body);
+ }
+}