Ignore any errors when adding default NS / DB / TB

This commit is contained in:
Tobie Morgan Hitchcock 2022-04-04 23:24:39 +01:00
parent 64eedd413f
commit 8980929a3c

View file

@ -245,35 +245,41 @@ impl Transaction {
// Get all namespaces // Get all namespaces
pub async fn add_ns(&mut self, ns: &str) -> Result<(), Error> { pub async fn add_ns(&mut self, ns: &str) -> Result<(), Error> {
let key = crate::key::ns::new(ns); let key = crate::key::ns::new(ns);
self.put( let _ = self
key, .put(
DefineNamespaceStatement { key,
name: ns.to_owned(), DefineNamespaceStatement {
}, name: ns.to_owned(),
) },
.await )
.await;
Ok(())
} }
// Get all namespace logins // Get all namespace logins
pub async fn add_db(&mut self, ns: &str, db: &str) -> Result<(), Error> { pub async fn add_db(&mut self, ns: &str, db: &str) -> Result<(), Error> {
let key = crate::key::db::new(ns, db); let key = crate::key::db::new(ns, db);
self.put( let _ = self
key, .put(
DefineDatabaseStatement { key,
name: db.to_owned(), DefineDatabaseStatement {
}, name: db.to_owned(),
) },
.await )
.await;
Ok(())
} }
// Get all namespace tokens // Get all namespace tokens
pub async fn add_tb(&mut self, ns: &str, db: &str, tb: &str) -> Result<(), Error> { pub async fn add_tb(&mut self, ns: &str, db: &str, tb: &str) -> Result<(), Error> {
let key = crate::key::tb::new(ns, db, tb); let key = crate::key::tb::new(ns, db, tb);
self.put( let _ = self
key, .put(
DefineTableStatement { key,
name: tb.to_owned(), DefineTableStatement {
..DefineTableStatement::default() name: tb.to_owned(),
}, ..DefineTableStatement::default()
) },
.await )
.await;
Ok(())
} }
} }