upend/db/src/inner/models.rs

35 lines
843 B
Rust

use super::schema::{data, meta, users};
use chrono::NaiveDateTime;
use serde::Serialize;
#[derive(Queryable, Insertable, Serialize, Debug, Clone)]
#[table_name = "data"]
pub struct Entry {
pub identity: Vec<u8>,
pub entity: Vec<u8>,
pub entity_searchable: Option<String>,
pub attribute: String,
pub value_str: Option<String>,
pub value_num: Option<f64>,
pub immutable: bool,
pub provenance: String,
pub user: Option<String>,
pub timestamp: NaiveDateTime,
}
#[derive(Queryable, Insertable, Serialize, Clone, Debug)]
#[table_name = "meta"]
pub struct MetaValue {
pub id: i32,
pub key: String,
pub value: String,
}
#[derive(Queryable, Insertable, Serialize, Clone, Debug)]
#[table_name = "users"]
pub struct UserValue {
pub id: i32,
pub username: String,
pub password: String,
}