From b61f15156a000c3f156af3d0fc809ca32912af34 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 13 May 2018 23:58:30 -0700 Subject: add scratch rust stuff --- rust/src/bin/show_creators.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 rust/src/bin/show_creators.rs (limited to 'rust/src/bin') 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::(&connection) + .expect("Error loading creators"); + + println!("Displaying {} creators", results.len()); + for creator in results { + println!("{}", creator.title); + println!("----------\n"); + println!("{}", creator.body); + } +} -- cgit v1.2.3