passing all tests ready for wrapper implementation

This commit is contained in:
shockrah 2019-12-08 23:34:21 -08:00
parent 9b035f07a2
commit 5803fc4c53
2 changed files with 48 additions and 2 deletions

View File

@ -1,7 +1,38 @@
#[macro_use]
extern crate diesel;
extern crate dotenv;
pub mod schema;
pub mod models;
use diesel::prelude::*;
use dotenv::dotenv;
use std::env;
struct DB {
conn: MysqlConnection,
url: String,
}
#[cfg(test)]
mod tests {
extern crate diesel;
use super::*;
use super::models::*;
use super::diesel::prelude::*;
use super::dotenv::dotenv;
use std::env;
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
fn test_conn() {
let url = env::var("DATABASE_URL")
.expect("DATABASE_URL not set!");
let conn = MysqlConnection::establish(&url)
.expect(&format!("Error connecting to {}", url));
let db = DB{conn, url};
println!("{}", db.url);
}
}

View File

@ -0,0 +1,15 @@
#[derive(Queryable)]
pub struct User {
pub id: u64,
pub strid: String,
display: String,
native: bool,
}
#[derive(Queryable)]
pub struct channels {
pub id: i64,
pub name: String,
pub ctype: i64,
}