Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate cmsbackend;
- extern crate diesel;
- use self::cmsbackend::*;
- use self::models::*;
- use self::diesel::prelude::*;
- fn main() {
- use cmsbackend::schema::*;
- let connection = establish_connection();
- let results = users::table.inner_join(posts::table)
- .select((users::name, posts::title))
- .load(&connection);
- }
- use diesel::pg::data_types::*;
- #[derive(Queryable)]
- pub struct Post {
- pub id: i32,
- pub title: String,
- pub body: Option<String>,
- pub published: bool,
- pub user_id: i32,
- pub creation_date: PgTimestamp,
- pub last_edit: PgTimestamp,
- pub foto: Option<String>,
- }
- #[derive(Queryable)]
- pub struct User {
- pub id: i32,
- pub name: String,
- pub pw: String,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement