summaryrefslogtreecommitdiffstats
path: root/rust/src/bin/show_creators.rs
blob: 160ca3c79cca3b5f33663944ea2ab6ffff44cf96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
    }
}