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.
24 lines
470 B
Rust
24 lines
470 B
Rust
4 years ago
|
use postgres::Row;
|
||
|
use serde::Deserialize;
|
||
|
|
||
|
#[derive(Clone, Debug)]
|
||
|
pub struct UserRecord {
|
||
|
pub id: i32,
|
||
|
pub name: String,
|
||
|
pub email: String,
|
||
|
pub password_hash: Vec<u8>,
|
||
|
pub salt: Vec<u8>,
|
||
|
}
|
||
|
|
||
|
impl UserRecord {
|
||
|
pub fn from_ordered_row(row: &Row) -> Self {
|
||
|
Self {
|
||
|
id: row.get(0),
|
||
|
name: row.get(1),
|
||
|
email: row.get(2),
|
||
|
password_hash: row.get(3),
|
||
|
salt: row.get(4),
|
||
|
}
|
||
|
}
|
||
|
}
|