Getting Jenkins working again.
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit
This commit is contained in:
parent
4a0ae807b8
commit
a1fa8016fb
641
Cargo.lock
generated
641
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,4 @@
|
|||||||
pub mod database;
|
use crate::{data::IDPath, error::MTTError};
|
||||||
pub mod id;
|
|
||||||
mod record;
|
|
||||||
pub mod table;
|
|
||||||
|
|
||||||
use crate::{data::database::Database, error::MTTError};
|
|
||||||
use std::{collections::HashMap, fmt, ops::Deref};
|
use std::{collections::HashMap, fmt, ops::Deref};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -35,7 +30,7 @@ mod errors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct Global {
|
struct Global {
|
||||||
databases: HashMap<String, Database>,
|
databases: HashMap<String, IDPath>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Global {
|
impl Global {
|
||||||
@ -45,7 +40,7 @@ impl Global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_database(&mut self, name: &str, db: Database) -> Result<(), MTTError> {
|
fn add_database(&mut self, name: &str, db: IDPath) -> Result<(), MTTError> {
|
||||||
match self.databases.get(name) {
|
match self.databases.get(name) {
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
let err = GblError::DuplicateDB(name.to_string());
|
let err = GblError::DuplicateDB(name.to_string());
|
||||||
@ -60,7 +55,7 @@ impl Global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Deref for Global {
|
impl Deref for Global {
|
||||||
type Target = HashMap<String, Database>;
|
type Target = HashMap<String, IDPath>;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.databases
|
&self.databases
|
||||||
@ -80,7 +75,7 @@ mod gblverses {
|
|||||||
#[test]
|
#[test]
|
||||||
fn add_database() {
|
fn add_database() {
|
||||||
let mut gbl = Global::new();
|
let mut gbl = Global::new();
|
||||||
let db = Database::new();
|
let db = IDPath::new();
|
||||||
gbl.add_database("barney", db).unwrap();
|
gbl.add_database("barney", db).unwrap();
|
||||||
assert_eq!(gbl.len(), 1);
|
assert_eq!(gbl.len(), 1);
|
||||||
}
|
}
|
||||||
@ -88,8 +83,8 @@ mod gblverses {
|
|||||||
#[test]
|
#[test]
|
||||||
fn no_duplicate_dbs() {
|
fn no_duplicate_dbs() {
|
||||||
let mut gbl = Global::new();
|
let mut gbl = Global::new();
|
||||||
let db1 = Database::new();
|
let db1 = IDPath::new();
|
||||||
let db2 = Database::new();
|
let db2 = IDPath::new();
|
||||||
let name = "duplicate";
|
let name = "duplicate";
|
||||||
gbl.add_database("barney", db2).unwrap();
|
gbl.add_database("barney", db2).unwrap();
|
||||||
match gbl.add_database("barney", db1) {
|
match gbl.add_database("barney", db1) {
|
@ -1,4 +1,4 @@
|
|||||||
use crate::data::{database::DBError, id::IDError, table::TBLError, GblError};
|
use crate::data::{database::DBError, global::GblError, id::IDError, table::TBLError};
|
||||||
use std::{error::Error, fmt};
|
use std::{error::Error, fmt};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user