//! WARNING: This file is generated, derived from table system.record, DO NOT EDIT
use chrono::datetime::DateTime;
use chrono::offset::utc::UTC;
use uuid::Uuid;
use rustorm::dao::Dao;
use rustorm::dao::IsDao;
use rustorm::table::IsTable;
use rustorm::table::Column;
use rustorm::table::Table;
///
/// All User table should inherit from this one
///
#[derive(RustcDecodable, RustcEncodable)]
#[derive(Debug, Clone)]
pub struct Record {
/// @Active
/// default: true
/// not nullable
/// db data type: boolean
pub active:bool,
/// db data type: character varying
pub description:Option<String>,
/// db data type: text
pub help:Option<String>,
/// db data type: character varying
pub name:Option<String>,
/// --inherited--
/// db data type: uuid
pub client_id:Option<Uuid>,
/// default: now()
/// not nullable
/// --inherited--
/// db data type: timestamp with time zone
pub created:DateTime<UTC>,
/// --inherited--
/// db data type: uuid
pub created_by:Option<Uuid>,
/// --inherited--
/// db data type: uuid
pub organization_id:Option<Uuid>,
/// --inherited--
/// db data type: numeric
pub priority:Option<f64>,
/// default: now()
/// not nullable
/// --inherited--
/// db data type: timestamp with time zone
pub updated:DateTime<UTC>,
/// --inherited--
/// db data type: uuid
pub updated_by:Option<Uuid>,
}
// Generated columns for easier development of dynamic queries without sacrificing wrong spelling of column names
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static organization_id: &'static str = "record.organization_id";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static client_id: &'static str = "record.client_id";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static created: &'static str = "record.created";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static created_by: &'static str = "record.created_by";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static updated: &'static str = "record.updated";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static updated_by: &'static str = "record.updated_by";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static priority: &'static str = "record.priority";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static name: &'static str = "record.name";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static description: &'static str = "record.description";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static help: &'static str = "record.help";
#[allow(non_upper_case_globals)]
#[allow(dead_code)]
pub static active: &'static str = "record.active";
impl IsDao for Record{
fn from_dao(dao:&Dao)->Self{
Record{
organization_id: dao.get_opt("organization_id"),
client_id: dao.get_opt("client_id"),
created: dao.get("created"),
created_by: dao.get_opt("created_by"),
updated: dao.get("updated"),
updated_by: dao.get_opt("updated_by"),
priority: dao.get_opt("priority"),
name: dao.get_opt("name"),
description: dao.get_opt("description"),
help: dao.get_opt("help"),
active: dao.get("active"),
}
}
}
impl IsTable for Record{
fn table()->Table{
Table{
schema:"system".to_string(),
name:"record".to_string(),
parent_table:Some("base".to_string()),
sub_table:vec!["address".to_string(),"api_key".to_string(),"cart".to_string(),"cart_line".to_string(),"category".to_string(),"client".to_string(),"invoice".to_string(),"order_line".to_string(),"orders".to_string(),"organization".to_string(),"photo".to_string(),"photo_sizes".to_string(),"product".to_string(),"review".to_string(),"settings".to_string(),"user_info".to_string(),"user_location".to_string(),"user_review".to_string(),"users".to_string(),"wishlist".to_string(),"wishlist_line".to_string(),"country".to_string(),"currency".to_string(),"exchange_rate".to_string(),],
comment:Some("All User table should inherit from this one".to_string()),
columns:
vec![
Column{
name:"organization_id".to_string(),
data_type:"Uuid".to_string(),
db_data_type:"uuid".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:true,
default:None,
comment:None,
foreign:None,
},
Column{
name:"client_id".to_string(),
data_type:"Uuid".to_string(),
db_data_type:"uuid".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:true,
default:None,
comment:None,
foreign:None,
},
Column{
name:"created".to_string(),
data_type:"DateTime<UTC>".to_string(),
db_data_type:"timestamp with time zone".to_string(),
is_primary:false, is_unique:false, not_null:true, is_inherited:true,
default:Some("now()".to_string()),
comment:None,
foreign:None,
},
Column{
name:"created_by".to_string(),
data_type:"Uuid".to_string(),
db_data_type:"uuid".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:true,
default:None,
comment:None,
foreign:None,
},
Column{
name:"updated".to_string(),
data_type:"DateTime<UTC>".to_string(),
db_data_type:"timestamp with time zone".to_string(),
is_primary:false, is_unique:false, not_null:true, is_inherited:true,
default:Some("now()".to_string()),
comment:None,
foreign:None,
},
Column{
name:"updated_by".to_string(),
data_type:"Uuid".to_string(),
db_data_type:"uuid".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:true,
default:None,
comment:None,
foreign:None,
},
Column{
name:"priority".to_string(),
data_type:"f64".to_string(),
db_data_type:"numeric".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:true,
default:None,
comment:None,
foreign:None,
},
Column{
name:"name".to_string(),
data_type:"String".to_string(),
db_data_type:"character varying".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:false,
default:None,
comment:None,
foreign:None,
},
Column{
name:"description".to_string(),
data_type:"String".to_string(),
db_data_type:"character varying".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:false,
default:None,
comment:None,
foreign:None,
},
Column{
name:"help".to_string(),
data_type:"String".to_string(),
db_data_type:"text".to_string(),
is_primary:false, is_unique:false, not_null:false, is_inherited:false,
default:None,
comment:None,
foreign:None,
},
Column{
name:"active".to_string(),
data_type:"bool".to_string(),
db_data_type:"boolean".to_string(),
is_primary:false, is_unique:false, not_null:true, is_inherited:false,
default:Some("true".to_string()),
comment:Some("@Active".to_string()),
foreign:None,
},
],
}
}
}