blob: 968d254250c5a84366058b5ae9f1cb1aec86e5ee (
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 fatcat;
extern crate diesel;
use self::fatcat::*;
use self::models::*;
use self::diesel::prelude::*;
fn main() {
use diesel_demo::database_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);
}
}
|