diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-13 23:58:30 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-13 23:58:30 -0700 |
commit | b61f15156a000c3f156af3d0fc809ca32912af34 (patch) | |
tree | 9eadaea5593929ada9977c55c5951ad4318d6166 /rust/src/bin/show_creators.rs | |
parent | 9c05b0848f2ed0047544e2859d5c50d1739e45b0 (diff) | |
download | fatcat-b61f15156a000c3f156af3d0fc809ca32912af34.tar.gz fatcat-b61f15156a000c3f156af3d0fc809ca32912af34.zip |
add scratch rust stuff
Diffstat (limited to 'rust/src/bin/show_creators.rs')
-rw-r--r-- | rust/src/bin/show_creators.rs | 24 |
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); + } +} |