You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
394 B
Rust
19 lines
394 B
Rust
5 years ago
|
#![allow(proc_macro_derive_resolution_fallback)]
|
||
|
|
||
|
use diesel;
|
||
|
use diesel::prelude::*;
|
||
|
use super::schema::users;
|
||
|
|
||
|
#[derive(Queryable, AsChangeset, Serialize, Deserialize)]
|
||
|
#[table_name = "users"]
|
||
|
pub struct User {
|
||
|
pub id: i32,
|
||
|
pub login: String,
|
||
|
}
|
||
|
|
||
|
impl User {
|
||
|
pub fn all(connection: &PgConnection) -> QueryResult<Vec<User>> {
|
||
|
users::table.load::<User>(&*connection)
|
||
|
}
|
||
|
}
|