Setup store to hold databases.
This commit is contained in:
		
							
								
								
									
										18
									
								
								src/morethantext/database.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/morethantext/database.rs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
#[derive(Clone, Debug)]
 | 
			
		||||
pub struct Database;
 | 
			
		||||
 | 
			
		||||
impl Database {
 | 
			
		||||
    fn new() -> Self {
 | 
			
		||||
        Self {}
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod dbase {
 | 
			
		||||
    use super::*;
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn create_new() {
 | 
			
		||||
        Database::new();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
mod cache;
 | 
			
		||||
mod database;
 | 
			
		||||
mod error;
 | 
			
		||||
mod store;
 | 
			
		||||
 | 
			
		||||
@@ -8,6 +9,7 @@ use async_std::{
 | 
			
		||||
    task::spawn,
 | 
			
		||||
};
 | 
			
		||||
use cache::Cache;
 | 
			
		||||
use database::Database;
 | 
			
		||||
use error::{ErrorCode, MTTError};
 | 
			
		||||
use store::Store;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,16 @@
 | 
			
		||||
use super::{Data, Database};
 | 
			
		||||
use std::collections::HashMap;
 | 
			
		||||
 | 
			
		||||
#[derive(Clone, Debug)]
 | 
			
		||||
pub struct Store;
 | 
			
		||||
pub struct Store {
 | 
			
		||||
    data: HashMap<String, Data<Database>>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Store {
 | 
			
		||||
    pub fn new() -> Self {
 | 
			
		||||
        Self {}
 | 
			
		||||
        Self {
 | 
			
		||||
            data: HashMap::new(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn list(&self) -> Vec<String> {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user