Hello. I do this and got all data. but i only need only username and title. How to do this.Thank you.
pub struct UserRoleList(pub Vec<(Role, User)>);
impl UserRoleList { pub fn list(connection: &PgConnection) -> Self { use crate::schema::{roles,users}; use diesel::RunQueryDsl; use diesel::QueryDsl;
let result = roles::table.inner_join(users::table) .load::<(Role, User)>(connection) .expect("Error loading "); UserRoleList(result) }
}
Hi, like SQL you can use a select clause, for example: github.com/practical-rust-web-deve...
thank you
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hello. I do this and got all data. but i only need only username and title. How to do this.Thank you.
[derive(Serialize, Deserialize)]
pub struct UserRoleList(pub Vec<(Role, User)>);
impl UserRoleList {
pub fn list(connection: &PgConnection) -> Self {
use crate::schema::{roles,users};
use diesel::RunQueryDsl;
use diesel::QueryDsl;
}
Hi, like SQL you can use a select clause, for example: github.com/practical-rust-web-deve...
thank you