Fix typos (#42)

Found via `codespell -L crate,inout,ser,fetchs,te,tre,whats`.
This commit is contained in:
Kian-Meng Ang 2022-08-21 20:13:38 +08:00 committed by GitHub
parent 28f66f4127
commit 40157f6170
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 24 deletions

View file

@ -25,7 +25,7 @@ pub struct Context<'a> {
parent: Option<&'a Context<'a>>, parent: Option<&'a Context<'a>>,
// An optional deadline. // An optional deadline.
deadline: Option<Instant>, deadline: Option<Instant>,
// Wether or not this context is cancelled. // Whether or not this context is cancelled.
cancelled: Arc<AtomicBool>, cancelled: Arc<AtomicBool>,
// A collection of read only values stored in this context. // A collection of read only values stored in this context.
values: Option<HashMap<String, Cow<'a, Value>>>, values: Option<HashMap<String, Cow<'a, Value>>>,
@ -58,7 +58,7 @@ impl<'a> Context<'a> {
} }
} }
// Add cancelation to the context. The value that is returned will cancel // Add cancellation to the context. The value that is returned will cancel
// the context and it's children once called. // the context and it's children once called.
pub fn add_cancel(&mut self) -> Canceller { pub fn add_cancel(&mut self) -> Canceller {
let cancelled = self.cancelled.clone(); let cancelled = self.cancelled.clone();

View file

@ -10,7 +10,7 @@ impl From<js::Error> for Error {
line, line,
} => Error::InvalidScript { } => Error::InvalidScript {
message: format!( message: format!(
"An exception occured{}: {}{}", "An exception occurred{}: {}{}",
match file.is_empty() { match file.is_empty() {
false => format!(" at {}:{}", file, line), false => format!(" at {}:{}", file, line),
true => String::default(), true => String::default(),
@ -26,7 +26,7 @@ impl From<js::Error> for Error {
), ),
}, },
js::Error::Unknown => Error::InvalidScript { js::Error::Unknown => Error::InvalidScript {
message: "An unknown error occured".to_string(), message: "An unknown error occurred".to_string(),
}, },
_ => Error::InvalidScript { _ => Error::InvalidScript {
message: e.to_string(), message: e.to_string(),

View file

@ -286,7 +286,7 @@ impl Datastore {
let mut txn = self.transaction(false, false).await?; let mut txn = self.transaction(false, false).await?;
// Process the export // Process the export
txn.export(&ns, &db, chn).await?; txn.export(&ns, &db, chn).await?;
// Everythign ok // Everything ok
Ok(()) Ok(())
} }
} }

View file

@ -1286,7 +1286,7 @@ impl Transaction {
chn.send(bytes!("")).await?; chn.send(bytes!("")).await?;
} }
} }
// Output INDEXS // Output INDEXES
let ixs = self.all_ix(ns, db, &tb.name).await?; let ixs = self.all_ix(ns, db, &tb.name).await?;
if !ixs.is_empty() { if !ixs.is_empty() {
for ix in ixs.iter() { for ix in ixs.iter() {

View file

@ -47,7 +47,7 @@ impl Param {
Some(v) => { Some(v) => {
// Get the path parts // Get the path parts
let pth: &[Part] = self; let pth: &[Part] = self;
// Process the paramater value // Process the parameter value
let res = v.compute(ctx, opt, txn, doc).await?; let res = v.compute(ctx, opt, txn, doc).await?;
// Return the desired field // Return the desired field
res.get(ctx, opt, txn, pth.next()).await res.get(ctx, opt, txn, pth.next()).await
@ -60,7 +60,7 @@ impl Param {
Some(v) => { Some(v) => {
// Get the path parts // Get the path parts
let pth: &[Part] = self; let pth: &[Part] = self;
// Process the paramater value // Process the parameter value
let res = v.compute(ctx, opt, txn, doc).await?; let res = v.compute(ctx, opt, txn, doc).await?;
// Return the desired field // Return the desired field
res.get(ctx, opt, txn, pth.next()).await res.get(ctx, opt, txn, pth.next()).await

View file

@ -166,7 +166,7 @@ impl InfoStatement {
tmp.insert(v.name.to_string(), v.to_string().into()); tmp.insert(v.name.to_string(), v.to_string().into());
} }
res.insert("fd".to_owned(), tmp.into()); res.insert("fd".to_owned(), tmp.into());
// Process the indexs // Process the indexes
let mut tmp = Object::default(); let mut tmp = Object::default();
for v in run.all_ix(opt.ns(), opt.db(), tb).await?.iter() { for v in run.all_ix(opt.ns(), opt.db(), tb).await?.iter() {
tmp.insert(v.name.to_string(), v.to_string().into()); tmp.insert(v.name.to_string(), v.to_string().into());

View file

@ -53,7 +53,7 @@ fn path_valid(v: &str) -> Result<(), String> {
} }
Err(String::from( Err(String::from(
"\ "\
Provide a valid database path paramater\ Provide a valid database path parameter\
", ",
)) ))
} }

View file

@ -11,11 +11,11 @@ use surrealdb::sql::Object;
use surrealdb::Session; use surrealdb::Session;
pub async fn signin(vars: Object) -> Result<String, Error> { pub async fn signin(vars: Object) -> Result<String, Error> {
// Parse the speficied variables // Parse the specified variables
let ns = vars.get("NS").or_else(|| vars.get("ns")); let ns = vars.get("NS").or_else(|| vars.get("ns"));
let db = vars.get("DB").or_else(|| vars.get("db")); let db = vars.get("DB").or_else(|| vars.get("db"));
let sc = vars.get("SC").or_else(|| vars.get("sc")); let sc = vars.get("SC").or_else(|| vars.get("sc"));
// Check if the paramaters exist // Check if the parameters exist
match (ns, db, sc) { match (ns, db, sc) {
(Some(ns), Some(db), Some(sc)) => { (Some(ns), Some(db), Some(sc)) => {
// Process the provided values // Process the provided values

View file

@ -9,11 +9,11 @@ use surrealdb::sql::Object;
use surrealdb::Session; use surrealdb::Session;
pub async fn signup(vars: Object) -> Result<String, Error> { pub async fn signup(vars: Object) -> Result<String, Error> {
// Parse the speficied variables // Parse the specified variables
let ns = vars.get("NS").or_else(|| vars.get("ns")); let ns = vars.get("NS").or_else(|| vars.get("ns"));
let db = vars.get("DB").or_else(|| vars.get("db")); let db = vars.get("DB").or_else(|| vars.get("db"));
let sc = vars.get("SC").or_else(|| vars.get("sc")); let sc = vars.get("SC").or_else(|| vars.get("sc"));
// Check if the paramaters exist // Check if the parameters exist
match (ns, db, sc) { match (ns, db, sc) {
(Some(ns), Some(db), Some(sc)) => { (Some(ns), Some(db), Some(sc)) => {
// Process the provided values // Process the provided values

View file

@ -275,7 +275,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "KILL $id"; let sql = "KILL $id";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("id") => id, String::from("id") => id,
=> &self.vars => &self.vars
@ -295,7 +295,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "LIVE SELECT * FROM $tb"; let sql = "LIVE SELECT * FROM $tb";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("tb") => tb.make_table(), String::from("tb") => tb.make_table(),
=> &self.vars => &self.vars
@ -317,7 +317,7 @@ impl Rpc {
let kvs = DB.get().unwrap(); let kvs = DB.get().unwrap();
// Get local copy of options // Get local copy of options
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the query paramaters // Specify the query parameters
let var = Some(self.vars.clone()); let var = Some(self.vars.clone());
// Execute the query on the database // Execute the query on the database
let res = kvs.execute(&sql, &self.session, var, opt.strict).await?; let res = kvs.execute(&sql, &self.session, var, opt.strict).await?;
@ -332,7 +332,7 @@ impl Rpc {
let kvs = DB.get().unwrap(); let kvs = DB.get().unwrap();
// Get local copy of options // Get local copy of options
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the query paramaters // Specify the query parameters
let var = Some(mrg! { vars.0, &self.vars }); let var = Some(mrg! { vars.0, &self.vars });
// Execute the query on the database // Execute the query on the database
let res = kvs.execute(&sql, &self.session, var, opt.strict).await?; let res = kvs.execute(&sql, &self.session, var, opt.strict).await?;
@ -353,7 +353,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "SELECT * FROM $what"; let sql = "SELECT * FROM $what";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("what") => what.make_table_or_thing(), String::from("what") => what.make_table_or_thing(),
=> &self.vars => &self.vars
@ -377,7 +377,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "CREATE $what CONTENT $data RETURN AFTER"; let sql = "CREATE $what CONTENT $data RETURN AFTER";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("what") => what.make_table_or_thing(), String::from("what") => what.make_table_or_thing(),
String::from("data") => data.into().into(), String::from("data") => data.into().into(),
@ -402,7 +402,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "UPDATE $what CONTENT $data RETURN AFTER"; let sql = "UPDATE $what CONTENT $data RETURN AFTER";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("what") => what.make_table_or_thing(), String::from("what") => what.make_table_or_thing(),
String::from("data") => data.into().into(), String::from("data") => data.into().into(),
@ -427,7 +427,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "UPDATE $what MERGE $data RETURN AFTER"; let sql = "UPDATE $what MERGE $data RETURN AFTER";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("what") => what.make_table_or_thing(), String::from("what") => what.make_table_or_thing(),
String::from("data") => data.into().into(), String::from("data") => data.into().into(),
@ -452,7 +452,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "UPDATE $what PATCH $data RETURN DIFF"; let sql = "UPDATE $what PATCH $data RETURN DIFF";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("what") => what.make_table_or_thing(), String::from("what") => what.make_table_or_thing(),
String::from("data") => data.into().into(), String::from("data") => data.into().into(),
@ -477,7 +477,7 @@ impl Rpc {
let opt = CF.get().unwrap(); let opt = CF.get().unwrap();
// Specify the SQL query string // Specify the SQL query string
let sql = "DELETE $what"; let sql = "DELETE $what";
// Specify the query paramaters // Specify the query parameters
let var = Some(map! { let var = Some(map! {
String::from("what") => what.make_table_or_thing(), String::from("what") => what.make_table_or_thing(),
=> &self.vars => &self.vars