init
This commit is contained in:
21
backend/src/bin/show_pictures.rs
Normal file
21
backend/src/bin/show_pictures.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
extern crate diesel;
|
||||
|
||||
use self::models::*;
|
||||
use diesel::prelude::*;
|
||||
use backend::*;
|
||||
|
||||
fn main() {
|
||||
use self::schema::pictures::dsl::*;
|
||||
|
||||
let connection = establish_connection();
|
||||
let results = pictures
|
||||
.limit(5)
|
||||
.load::<Picture>(&connection)
|
||||
.expect("Error loading pictures");
|
||||
|
||||
println!("Displaying {} pictures", results.len());
|
||||
for picture in results {
|
||||
println!("filepath: {}", picture.filepath);
|
||||
println!("\tid: {}", picture.id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user