initial commit

This commit is contained in:
2023-11-10 17:25:16 -03:00
commit fb030ce429
15 changed files with 207 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
use self::modelos::*;
use diesel::{prelude::*, connection};
use rust_diesel_blogs::*;
fn main() {
use self::schema::posts::dsl::*;
let connection = &mut establecer_coneccion();
let resultado = posts
.filter(published.eq(true))
.limit(10)
.select(Post::as_select())
.load(connection)
.expect("Error cargando posts");
println!("Mostrando {} posts", resultado.len());
for post in resultado {
println!("{}", post.title);
println!("- - - - - -",);
println!("{}", post.body);
}
}