43 lines
984 B
Rust
43 lines
984 B
Rust
pub mod member;
|
|
pub mod common;
|
|
pub mod invites;
|
|
pub mod channels;
|
|
pub mod messages;
|
|
|
|
use std::vec::Vec;
|
|
|
|
pub type BigInt = i64;
|
|
pub type UBigInt = u64;
|
|
|
|
pub type Integer = i32;
|
|
pub type UInteger = u32;
|
|
|
|
pub type VarChar = String;
|
|
|
|
pub enum Response<T> {
|
|
// A set of rows collected
|
|
Set(Vec<T>),
|
|
// Single row collected
|
|
Row(T),
|
|
// Nothing was found -> for select/update/delete's
|
|
Empty,
|
|
// Generic success for things like update/delete's
|
|
Success,
|
|
// Duplicate keys can sometimes fuck us over for inserts/update(why tf tho)
|
|
Duplicate,
|
|
// Not sure what this will be used for but maybe its useful at some point
|
|
Other(String)
|
|
}
|
|
|
|
|
|
#[macro_export]
|
|
macro_rules! fetch_row {
|
|
($table:literal, $col:literal, $key:expr, $rtype:ty,$conn:expr) => {
|
|
let lib_str = format!("SELECT * FROM {} WHERE {} = :{}", $table, $col, $col);
|
|
let (_, $rtype) = $conn.first_exec!(lib_str, sql_params{
|
|
$col => $key,
|
|
});
|
|
}
|
|
}
|
|
|