Fix typos (#2764)
This commit is contained in:
parent
67fa54d792
commit
74ad693709
32 changed files with 71 additions and 71 deletions
|
@ -331,7 +331,7 @@ docker run --pull --rm -v $PWD:/volume -t clux/muslrust:stable cargo build --rel
|
||||||
|
|
||||||
### ✅ Compile for `windows-amd64`
|
### ✅ Compile for `windows-amd64`
|
||||||
|
|
||||||
> Compiling SurrealDB with windows OS requires **Administrator** priveledge!
|
> Compiling SurrealDB with windows OS requires **Administrator** privilege!
|
||||||
|
|
||||||
⚠**Tested on Windows 11 build 22H2(22621.963)**
|
⚠**Tested on Windows 11 build 22H2(22621.963)**
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ docker run --pull --rm -v $PWD:/volume -t clux/muslrust:stable cargo build --rel
|
||||||
|
|
||||||
e.g. "C:\patch"
|
e.g. "C:\patch"
|
||||||
|
|
||||||
> For some bizzare reasons, **patch.exe needs elevated priviledge** to be invoked during compilation
|
> For some bizzarre reasons, **patch.exe needs elevated privileges** to be invoked during compilation
|
||||||
|
|
||||||
5. Add `gcc` and `patch` binary path to environment
|
5. Add `gcc` and `patch` binary path to environment
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ available in the nightly release.
|
||||||
Unfortunately for us the nightly release is a little unstable and there
|
Unfortunately for us the nightly release is a little unstable and there
|
||||||
was a [bug](https://github.com/rust-lang/rust/issues/110475) in the
|
was a [bug](https://github.com/rust-lang/rust/issues/110475) in the
|
||||||
latest version of the nightly compiler that prevents use from compiling
|
latest version of the nightly compiler that prevents use from compiling
|
||||||
some of surrealdb's depdendencies. To workaround this issue we've carefully
|
some of surrealdb's dependencies. To workaround this issue we've carefully
|
||||||
picked a version of the nightly compiler that works with both cargo-fuzz
|
picked a version of the nightly compiler that works with both cargo-fuzz
|
||||||
and our dependencies. This version is `nightly-2023-04-21`. To install
|
and our dependencies. This version is `nightly-2023-04-21`. To install
|
||||||
this version we simply need to run;
|
this version we simply need to run;
|
||||||
|
@ -58,7 +58,7 @@ The previous command will run the fuzzer in libfuzzer's default mode,
|
||||||
which means as a single thread. If you would like to speed fuzzing
|
which means as a single thread. If you would like to speed fuzzing
|
||||||
up we can make use of all cores, and use a dictionary file. e.g.
|
up we can make use of all cores, and use a dictionary file. e.g.
|
||||||
```
|
```
|
||||||
# -fork: Run N seperate process fuzzing in parralell in this case we
|
# -fork: Run N separate process fuzzing in parallel in this case we
|
||||||
# use nproc to match the number of processors on our local
|
# use nproc to match the number of processors on our local
|
||||||
# machine.
|
# machine.
|
||||||
# -dict: Make use the fuzzer specific dictionary file.
|
# -dict: Make use the fuzzer specific dictionary file.
|
||||||
|
|
|
@ -61,7 +61,7 @@ where
|
||||||
pub enum Method {
|
pub enum Method {
|
||||||
/// Sends an authentication token to the server
|
/// Sends an authentication token to the server
|
||||||
Authenticate,
|
Authenticate,
|
||||||
/// Perfoms a merge update operation
|
/// Performs a merge update operation
|
||||||
Merge,
|
Merge,
|
||||||
/// Creates a record in a table
|
/// Creates a record in a table
|
||||||
Create,
|
Create,
|
||||||
|
@ -81,7 +81,7 @@ pub enum Method {
|
||||||
/// Starts a live query
|
/// Starts a live query
|
||||||
#[doc(hidden)] // Not supported yet
|
#[doc(hidden)] // Not supported yet
|
||||||
Live,
|
Live,
|
||||||
/// Perfoms a patch update operation
|
/// Performs a patch update operation
|
||||||
Patch,
|
Patch,
|
||||||
/// Sends a raw query to the database
|
/// Sends a raw query to the database
|
||||||
Query,
|
Query,
|
||||||
|
@ -95,7 +95,7 @@ pub enum Method {
|
||||||
Signup,
|
Signup,
|
||||||
/// Removes a parameter from a connection
|
/// Removes a parameter from a connection
|
||||||
Unset,
|
Unset,
|
||||||
/// Perfoms an update operation
|
/// Performs an update operation
|
||||||
Update,
|
Update,
|
||||||
/// Selects a namespace and database to use
|
/// Selects a namespace and database to use
|
||||||
Use,
|
Use,
|
||||||
|
|
|
@ -103,7 +103,7 @@ where
|
||||||
|
|
||||||
fn into_future(self) -> Self::IntoFuture {
|
fn into_future(self) -> Self::IntoFuture {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
// Avoid establising another connection if already connected
|
// Avoid establishing another connection if already connected
|
||||||
if self.router.get().is_some() {
|
if self.router.get().is_some() {
|
||||||
return Err(Error::AlreadyConnected.into());
|
return Err(Error::AlreadyConnected.into());
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ mod tests {
|
||||||
tx3.commit().await.unwrap();
|
tx3.commit().await.unwrap();
|
||||||
|
|
||||||
// Note that we committed tx1, tx2, and tx3 in this order so far.
|
// Note that we committed tx1, tx2, and tx3 in this order so far.
|
||||||
// Therfore, the change feeds should give us
|
// Therefore, the change feeds should give us
|
||||||
// the mutations in the commit order, which is tx1, tx3, then tx2.
|
// the mutations in the commit order, which is tx1, tx3, then tx2.
|
||||||
|
|
||||||
let start: u64 = 0;
|
let start: u64 = 0;
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl<'a> Executor<'a> {
|
||||||
///
|
///
|
||||||
/// # Return
|
/// # Return
|
||||||
///
|
///
|
||||||
/// An `Err` if the transaction could not be commited;
|
/// An `Err` if the transaction could not be committed;
|
||||||
/// otherwise returns `Ok`.
|
/// otherwise returns `Ok`.
|
||||||
async fn commit(&mut self, local: bool) -> Result<(), Error> {
|
async fn commit(&mut self, local: bool) -> Result<(), Error> {
|
||||||
if local {
|
if local {
|
||||||
|
|
|
@ -516,7 +516,7 @@ impl Options {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check permissions if the autor is not already allowed to do the action
|
// Check permissions if the author is not already allowed to do the action
|
||||||
!is_allowed
|
!is_allowed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ impl Session {
|
||||||
Session::for_level(Level::Root, Role::Editor)
|
Session::for_level(Level::Root, Role::Editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a system session for the root level with Viwer role
|
/// Create a system session for the root level with Viewer role
|
||||||
pub fn viewer() -> Session {
|
pub fn viewer() -> Session {
|
||||||
Session::for_level(Level::Root, Role::Viewer)
|
Session::for_level(Level::Root, Role::Viewer)
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl Body {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns wther the body is alread used.
|
/// Returns whether the body is already used.
|
||||||
pub fn used(&self) -> bool {
|
pub fn used(&self) -> bool {
|
||||||
match self.data.replace(BodyData::Used) {
|
match self.data.replace(BodyData::Used) {
|
||||||
BodyData::Used => true,
|
BodyData::Used => true,
|
||||||
|
|
|
@ -419,7 +419,7 @@ impl<'js> Request<'js> {
|
||||||
} else {
|
} else {
|
||||||
Err(Exception::throw_type(
|
Err(Exception::throw_type(
|
||||||
&ctx,
|
&ctx,
|
||||||
"request `init` paramater must either be a request object or a string",
|
"request `init` parameter must either be a request object or a string",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::{future::Future, pin::Pin};
|
||||||
use channel::Receiver;
|
use channel::Receiver;
|
||||||
use futures::{FutureExt, Stream, StreamExt};
|
use futures::{FutureExt, Stream, StreamExt};
|
||||||
|
|
||||||
/// A newtype struct over reciever implementing the [`Stream`] trait.
|
/// A newtype struct over receiver implementing the [`Stream`] trait.
|
||||||
pub struct ChannelStream<R>(Receiver<R>);
|
pub struct ChannelStream<R>(Receiver<R>);
|
||||||
|
|
||||||
impl<R> Stream for ChannelStream<R> {
|
impl<R> Stream for ChannelStream<R> {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/// Returns wether the status code is an null body status
|
/// Returns whether the status code is an null body status
|
||||||
pub fn is_null_body_status(status: u16) -> bool {
|
pub fn is_null_body_status(status: u16) -> bool {
|
||||||
matches!(status, 101 | 103 | 204 | 205 | 304)
|
matches!(status, 101 | 103 | 204 | 205 | 304)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns wether the status code is an ok status
|
/// Returns whether the status code is an ok status
|
||||||
pub fn is_ok_status(status: u16) -> bool {
|
pub fn is_ok_status(status: u16) -> bool {
|
||||||
(200..=299).contains(&status)
|
(200..=299).contains(&status)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns wether the status code is an redirect status
|
/// Returns whether the status code is an redirect status
|
||||||
pub fn is_redirect_status(status: u16) -> bool {
|
pub fn is_redirect_status(status: u16) -> bool {
|
||||||
[301, 302, 303, 307, 308].contains(&status)
|
[301, 302, 303, 307, 308].contains(&status)
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub async fn run(
|
||||||
// Get the context global object
|
// Get the context global object
|
||||||
let global = ctx.globals();
|
let global = ctx.globals();
|
||||||
|
|
||||||
// SAFETY: This is safe because the runtime only lifes for the duration of this
|
// SAFETY: This is safe because the runtime only lives for the duration of this
|
||||||
// function. For the entire duration of which context, opt, txn and doc are valid.
|
// function. For the entire duration of which context, opt, txn and doc are valid.
|
||||||
unsafe{ create_query_data(context,opt,txn,doc,&ctx) }?;
|
unsafe{ create_query_data(context,opt,txn,doc,&ctx) }?;
|
||||||
// Register the surrealdb module as a global object
|
// Register the surrealdb module as a global object
|
||||||
|
|
|
@ -561,7 +561,7 @@ mod tests {
|
||||||
};
|
};
|
||||||
let res = basic(&ds, &mut sess, "user", "invalid").await;
|
let res = basic(&ds, &mut sess, "user", "invalid").await;
|
||||||
|
|
||||||
assert!(res.is_err(), "Unexpect successful signin: {:?}", res);
|
assert!(res.is_err(), "Unexpected successful signin: {:?}", res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ mod tests {
|
||||||
};
|
};
|
||||||
let res = basic(&ds, &mut sess, "user", "invalid").await;
|
let res = basic(&ds, &mut sess, "user", "invalid").await;
|
||||||
|
|
||||||
assert!(res.is_err(), "Unexpect successful signin: {:?}", res);
|
assert!(res.is_err(), "Unexpected successful signin: {:?}", res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ mod tests {
|
||||||
};
|
};
|
||||||
let res = basic(&ds, &mut sess, "user", "invalid").await;
|
let res = basic(&ds, &mut sess, "user", "invalid").await;
|
||||||
|
|
||||||
assert!(res.is_err(), "Unexpect successful signin: {:?}", res);
|
assert!(res.is_err(), "Unexpected successful signin: {:?}", res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl Hb {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn suffix(ts: &Timestamp) -> Vec<u8> {
|
pub fn suffix(ts: &Timestamp) -> Vec<u8> {
|
||||||
// Add one to timestmap so we get a complete range inclusive of provided timestamp
|
// Add one to timestamp so we get a complete range inclusive of provided timestamp
|
||||||
// Also convert type
|
// Also convert type
|
||||||
let tskey: KeyTimestamp = KeyTimestamp {
|
let tskey: KeyTimestamp = KeyTimestamp {
|
||||||
value: ts.value + 1,
|
value: ts.value + 1,
|
||||||
|
|
|
@ -2643,7 +2643,7 @@ impl Transaction {
|
||||||
//
|
//
|
||||||
// Under the hood, this function calls the transaction's `set_versionstamped_key` for each change.
|
// Under the hood, this function calls the transaction's `set_versionstamped_key` for each change.
|
||||||
// Every change must be recorded by calling this struct's `record_change` function beforehand.
|
// Every change must be recorded by calling this struct's `record_change` function beforehand.
|
||||||
// If there was no preceeding `record_change` function calls for this transaction, this function will do nothing.
|
// If there were no preceding `record_change` function calls for this transaction, this function will do nothing.
|
||||||
//
|
//
|
||||||
// This function should be called only after all the changes have been made to the transaction.
|
// This function should be called only after all the changes have been made to the transaction.
|
||||||
// Otherwise, changes are missed in the change feed.
|
// Otherwise, changes are missed in the change feed.
|
||||||
|
|
|
@ -360,7 +360,7 @@ impl Intersect<Self> for Array {
|
||||||
|
|
||||||
// Documented with the assumption that it is just for arrays.
|
// Documented with the assumption that it is just for arrays.
|
||||||
pub(crate) trait Matches<T> {
|
pub(crate) trait Matches<T> {
|
||||||
/// Returns an array complimenting the origional where each value is true or false
|
/// Returns an array complimenting the original where each value is true or false
|
||||||
/// depending on whether it is == to the compared value.
|
/// depending on whether it is == to the compared value.
|
||||||
///
|
///
|
||||||
/// Admittedly, this is most often going to be used in `count(array::matches($arr, $val))`
|
/// Admittedly, this is most often going to be used in `count(array::matches($arr, $val))`
|
||||||
|
|
|
@ -114,7 +114,7 @@ macro_rules! impl_builtins {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Err(Err::Error(ParseError::Expected{
|
return Err(Err::Error(ParseError::Expected{
|
||||||
tried: $input,
|
tried: $input,
|
||||||
expected: "a path seperator `::`"
|
expected: "a path separator `::`"
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl fmt::Display for Duration {
|
||||||
// Calculate the total minutes
|
// Calculate the total minutes
|
||||||
let mins = secs / SECONDS_PER_MINUTE;
|
let mins = secs / SECONDS_PER_MINUTE;
|
||||||
let secs = secs % SECONDS_PER_MINUTE;
|
let secs = secs % SECONDS_PER_MINUTE;
|
||||||
// Calculate the total millseconds
|
// Calculate the total milliseconds
|
||||||
let msec = nano / NANOSECONDS_PER_MILLISECOND;
|
let msec = nano / NANOSECONDS_PER_MILLISECOND;
|
||||||
let nano = nano % NANOSECONDS_PER_MILLISECOND;
|
let nano = nano % NANOSECONDS_PER_MILLISECOND;
|
||||||
// Calculate the total microseconds
|
// Calculate the total microseconds
|
||||||
|
|
|
@ -31,14 +31,14 @@ pub enum Truncation {
|
||||||
Both,
|
Both,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A piece of the source code with a location and an optional explenation.
|
/// A piece of the source code with a location and an optional explanation.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Snippet {
|
pub struct Snippet {
|
||||||
/// The part of the orignal source code,
|
/// The part of the original source code,
|
||||||
source: String,
|
source: String,
|
||||||
/// Wether part of the source line was truncated.
|
/// Whether part of the source line was truncated.
|
||||||
truncation: Truncation,
|
truncation: Truncation,
|
||||||
/// The location of the snippet in the orignal source code.
|
/// The location of the snippet in the original source code.
|
||||||
location: Location,
|
location: Location,
|
||||||
/// The offset, in chars, into the snippet where the location is.
|
/// The offset, in chars, into the snippet where the location is.
|
||||||
offset: usize,
|
offset: usize,
|
||||||
|
@ -73,7 +73,7 @@ impl Snippet {
|
||||||
fn truncate_line(mut line: &str, around_offset: usize) -> (&str, Truncation, usize) {
|
fn truncate_line(mut line: &str, around_offset: usize) -> (&str, Truncation, usize) {
|
||||||
let full_line_length = line.chars().count();
|
let full_line_length = line.chars().count();
|
||||||
line = line.trim_start();
|
line = line.trim_start();
|
||||||
// Saturate in case the error ocurred in invalid leading whitespace.
|
// Saturate in case the error occurred in invalid leading whitespace.
|
||||||
let mut offset = around_offset.saturating_sub(full_line_length - line.chars().count());
|
let mut offset = around_offset.saturating_sub(full_line_length - line.chars().count());
|
||||||
line = line.trim_end();
|
line = line.trim_end();
|
||||||
let mut truncation = Truncation::None;
|
let mut truncation = Truncation::None;
|
||||||
|
|
|
@ -57,7 +57,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ExplainResultExt<I, O> {
|
pub trait ExplainResultExt<I, O> {
|
||||||
/// A function which adds a explaination to an error if the parser fails at a place which can
|
/// A function which adds a explanation to an error if the parser fails at a place which can
|
||||||
/// be parsed with the given parser.
|
/// be parsed with the given parser.
|
||||||
fn explain<P, O1>(self, explain: &'static str, condition: P) -> Self
|
fn explain<P, O1>(self, explain: &'static str, condition: P) -> Self
|
||||||
where
|
where
|
||||||
|
|
|
@ -794,7 +794,7 @@ fn polygon_vals(i: &str) -> IResult<&str, Polygon<f64>> {
|
||||||
let (i, mut e) =
|
let (i, mut e) =
|
||||||
delimited_list1(openbracket, commas, terminated(line_vals, mightbespace), char(']'))(i)?;
|
delimited_list1(openbracket, commas, terminated(line_vals, mightbespace), char(']'))(i)?;
|
||||||
let v = e.split_off(1);
|
let v = e.split_off(1);
|
||||||
// delimited_list1 guarentees there is atleast one value.
|
// delimited_list1 guarantees there is atleast one value.
|
||||||
let e = e.into_iter().next().unwrap();
|
let e = e.into_iter().next().unwrap();
|
||||||
Ok((i, Polygon::new(e, v)))
|
Ok((i, Polygon::new(e, v)))
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl Limit {
|
||||||
Ok(v) => Err(Error::InvalidLimit {
|
Ok(v) => Err(Error::InvalidLimit {
|
||||||
value: v.as_string(),
|
value: v.as_string(),
|
||||||
}),
|
}),
|
||||||
// A different error occured
|
// A different error occurred
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl Start {
|
||||||
Ok(v) => Err(Error::InvalidStart {
|
Ok(v) => Err(Error::InvalidStart {
|
||||||
value: v.as_string(),
|
value: v.as_string(),
|
||||||
}),
|
}),
|
||||||
// A different error occured
|
// A different error occurred
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn option(i: &str) -> IResult<&str, OptionStatement> {
|
||||||
let (i, _) = shouldbespace(i)?;
|
let (i, _) = shouldbespace(i)?;
|
||||||
let (i, n) = ident(i)?;
|
let (i, n) = ident(i)?;
|
||||||
let (i, v) = expected(
|
let (i, v) = expected(
|
||||||
"'=' follwed by a value for the option",
|
"'=' followed by a value for the option",
|
||||||
cut(opt(alt((
|
cut(opt(alt((
|
||||||
value(true, tuple((mightbespace, char('='), mightbespace, tag_no_case("TRUE")))),
|
value(true, tuple((mightbespace, char('='), mightbespace, tag_no_case("TRUE")))),
|
||||||
value(false, tuple((mightbespace, char('='), mightbespace, tag_no_case("FALSE")))),
|
value(false, tuple((mightbespace, char('='), mightbespace, tag_no_case("FALSE")))),
|
||||||
|
|
|
@ -230,7 +230,7 @@ pub fn select(i: &str) -> IResult<&str, SelectStatement> {
|
||||||
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
let (i, parallel) = opt(preceded(shouldbespace, tag_no_case("PARALLEL")))(i)?;
|
||||||
let (i, explain) = opt(preceded(shouldbespace, explain))(i)?;
|
let (i, explain) = opt(preceded(shouldbespace, explain))(i)?;
|
||||||
let (i, _) = expected(
|
let (i, _) = expected(
|
||||||
"one of WITH, WHERE, SPLIT, GROUP, ORDER, LIMIT, START, FETCH, VERSION, TIMEOUT, PARELLEL, or EXPLAIN",
|
"one of WITH, WHERE, SPLIT, GROUP, ORDER, LIMIT, START, FETCH, VERSION, TIMEOUT, PARALLEL, or EXPLAIN",
|
||||||
cut(peek(ending::query))
|
cut(peek(ending::query))
|
||||||
)(i)?;
|
)(i)?;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ use nom::{Err, InputLength, Parser};
|
||||||
|
|
||||||
/// Parses a parser delimited by two other parsers.
|
/// Parses a parser delimited by two other parsers.
|
||||||
///
|
///
|
||||||
/// This parser failes (not errors) if the second delimiting parser returns an error.
|
/// This parser fails (not errors) if the second delimiting parser returns an error.
|
||||||
pub fn expect_delimited<I, D, V, T, O, O1>(
|
pub fn expect_delimited<I, D, V, T, O, O1>(
|
||||||
mut prefix: D,
|
mut prefix: D,
|
||||||
mut value: V,
|
mut value: V,
|
||||||
|
@ -51,10 +51,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a delimited list with an option trailing seperator in the form of:
|
/// Parses a delimited list with an option trailing separator in the form of:
|
||||||
///
|
///
|
||||||
///```text
|
///```text
|
||||||
/// PREFIX $(PARSER)SEPERATOR* $(SEPERATOR)? TERMINATOR
|
/// PREFIX $(PARSER)SEPARATOR* $(SEPARATOR)? TERMINATOR
|
||||||
///```
|
///```
|
||||||
///
|
///
|
||||||
/// Which parsers productions like
|
/// Which parsers productions like
|
||||||
|
@ -63,14 +63,14 @@ where
|
||||||
/// First parses the prefix and returns it's error if there is one.
|
/// First parses the prefix and returns it's error if there is one.
|
||||||
/// The tries to parse the terminator. If there is one the parser completes else it tries to parse
|
/// The tries to parse the terminator. If there is one the parser completes else it tries to parse
|
||||||
/// the value, else it returns the parsed values.
|
/// the value, else it returns the parsed values.
|
||||||
/// Then it tries to parse the seperator, if there is one it start again trying to parse the
|
/// Then it tries to parse the separator, if there is one it start again trying to parse the
|
||||||
/// terminator followed by a value if there is no terminator. Else it tries to parse the terminator
|
/// terminator followed by a value if there is no terminator. Else it tries to parse the terminator
|
||||||
/// and if there is none it returns a failure. Otherwise completes with an vec of the parsed
|
/// and if there is none it returns a failure. Otherwise completes with an vec of the parsed
|
||||||
/// values.
|
/// values.
|
||||||
///
|
///
|
||||||
pub fn delimited_list0<I, D, S, V, T, O, O1, O2>(
|
pub fn delimited_list0<I, D, S, V, T, O, O1, O2>(
|
||||||
mut prefix: D,
|
mut prefix: D,
|
||||||
mut seperator: S,
|
mut separator: S,
|
||||||
mut value: V,
|
mut value: V,
|
||||||
mut terminator: T,
|
mut terminator: T,
|
||||||
) -> impl FnMut(I) -> IResult<I, Vec<O>, ParseError<I>>
|
) -> impl FnMut(I) -> IResult<I, Vec<O>, ParseError<I>>
|
||||||
|
@ -96,7 +96,7 @@ where
|
||||||
}
|
}
|
||||||
let (i, value) = value.parse(input)?;
|
let (i, value) = value.parse(input)?;
|
||||||
res.push(value);
|
res.push(value);
|
||||||
match seperator.parse(i.clone()) {
|
match separator.parse(i.clone()) {
|
||||||
Ok((i, _)) => {
|
Ok((i, _)) => {
|
||||||
input = i;
|
input = i;
|
||||||
}
|
}
|
||||||
|
@ -120,10 +120,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a delimited list with an option trailing seperator in the form of:
|
/// Parses a delimited list with an option trailing separator in the form of:
|
||||||
///
|
///
|
||||||
///```text
|
///```text
|
||||||
/// PREFIX $(PARSER)SEPERATOR+ $(SEPERATOR)? TERMINATOR
|
/// PREFIX $(PARSER)SEPARATOR+ $(SEPARATOR)? TERMINATOR
|
||||||
///```
|
///```
|
||||||
///
|
///
|
||||||
/// Which parsers productions like
|
/// Which parsers productions like
|
||||||
|
@ -132,14 +132,14 @@ where
|
||||||
/// First parses the prefix and returns it's error if there is one.
|
/// First parses the prefix and returns it's error if there is one.
|
||||||
/// The tries to parse the terminator. If there is one the parser completes else it tries to parse
|
/// The tries to parse the terminator. If there is one the parser completes else it tries to parse
|
||||||
/// the value, else it returns the parsed values.
|
/// the value, else it returns the parsed values.
|
||||||
/// Then it tries to parse the seperator, if there is one it start again trying to parse the
|
/// Then it tries to parse the separator, if there is one it start again trying to parse the
|
||||||
/// terminator followed by a value if there is no terminator. Else it tries to parse the terminator
|
/// terminator followed by a value if there is no terminator. Else it tries to parse the terminator
|
||||||
/// and if there is none it returns a failure. Otherwise completes with an vec of the parsed
|
/// and if there is none it returns a failure. Otherwise completes with an vec of the parsed
|
||||||
/// values.
|
/// values.
|
||||||
///
|
///
|
||||||
pub fn delimited_list1<I, D, S, V, T, O, O1, O2>(
|
pub fn delimited_list1<I, D, S, V, T, O, O1, O2>(
|
||||||
mut prefix: D,
|
mut prefix: D,
|
||||||
mut seperator: S,
|
mut separator: S,
|
||||||
mut value: V,
|
mut value: V,
|
||||||
mut terminator: T,
|
mut terminator: T,
|
||||||
) -> impl FnMut(I) -> IResult<I, Vec<O>, ParseError<I>>
|
) -> impl FnMut(I) -> IResult<I, Vec<O>, ParseError<I>>
|
||||||
|
@ -165,7 +165,7 @@ where
|
||||||
}
|
}
|
||||||
let (i, value) = value.parse(input)?;
|
let (i, value) = value.parse(input)?;
|
||||||
res.push(value);
|
res.push(value);
|
||||||
match seperator.parse(i.clone()) {
|
match separator.parse(i.clone()) {
|
||||||
Ok((i, _)) => {
|
Ok((i, _)) => {
|
||||||
input = i;
|
input = i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1297,7 +1297,7 @@ impl Value {
|
||||||
Value::Number(Number::Decimal(v)) => match v.try_into() {
|
Value::Number(Number::Decimal(v)) => match v.try_into() {
|
||||||
// The Decimal can be represented as a f64
|
// The Decimal can be represented as a f64
|
||||||
Ok(v) => Ok(v),
|
Ok(v) => Ok(v),
|
||||||
// Ths Decimal loses precision
|
// This Decimal loses precision
|
||||||
_ => Err(Error::CoerceTo {
|
_ => Err(Error::CoerceTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "f64".into(),
|
into: "f64".into(),
|
||||||
|
@ -1373,7 +1373,7 @@ impl Value {
|
||||||
Value::Number(Number::Decimal(ref v)) => match v.to_f64() {
|
Value::Number(Number::Decimal(ref v)) => match v.to_f64() {
|
||||||
// The Decimal can be represented as a Float
|
// The Decimal can be represented as a Float
|
||||||
Some(v) => Ok(Number::Float(v)),
|
Some(v) => Ok(Number::Float(v)),
|
||||||
// Ths BigDecimal loses precision
|
// This BigDecimal loses precision
|
||||||
None => Err(Error::CoerceTo {
|
None => Err(Error::CoerceTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "float".into(),
|
into: "float".into(),
|
||||||
|
@ -1396,7 +1396,7 @@ impl Value {
|
||||||
Value::Number(Number::Int(v)) => match Decimal::from_i64(v) {
|
Value::Number(Number::Int(v)) => match Decimal::from_i64(v) {
|
||||||
// The Int can be represented as a Decimal
|
// The Int can be represented as a Decimal
|
||||||
Some(v) => Ok(Number::Decimal(v)),
|
Some(v) => Ok(Number::Decimal(v)),
|
||||||
// Ths Int does not convert to a Decimal
|
// This Int does not convert to a Decimal
|
||||||
None => Err(Error::CoerceTo {
|
None => Err(Error::CoerceTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "decimal".into(),
|
into: "decimal".into(),
|
||||||
|
@ -1406,7 +1406,7 @@ impl Value {
|
||||||
Value::Number(Number::Float(v)) => match Decimal::from_f64(v) {
|
Value::Number(Number::Float(v)) => match Decimal::from_f64(v) {
|
||||||
// The Float can be represented as a Decimal
|
// The Float can be represented as a Decimal
|
||||||
Some(v) => Ok(Number::Decimal(v)),
|
Some(v) => Ok(Number::Decimal(v)),
|
||||||
// Ths Float does not convert to a Decimal
|
// This Float does not convert to a Decimal
|
||||||
None => Err(Error::CoerceTo {
|
None => Err(Error::CoerceTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "decimal".into(),
|
into: "decimal".into(),
|
||||||
|
@ -1797,7 +1797,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match v.parse::<bool>() {
|
Value::Strand(ref v) => match v.parse::<bool>() {
|
||||||
// The string can be represented as a Float
|
// The string can be represented as a Float
|
||||||
Ok(v) => Ok(v),
|
Ok(v) => Ok(v),
|
||||||
// Ths string is not a float
|
// This string is not a float
|
||||||
_ => Err(Error::ConvertTo {
|
_ => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "bool".into(),
|
into: "bool".into(),
|
||||||
|
@ -1832,7 +1832,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match v.parse::<i64>() {
|
Value::Strand(ref v) => match v.parse::<i64>() {
|
||||||
// The string can be represented as a Float
|
// The string can be represented as a Float
|
||||||
Ok(v) => Ok(Number::Int(v)),
|
Ok(v) => Ok(Number::Int(v)),
|
||||||
// Ths string is not a float
|
// This string is not a float
|
||||||
_ => Err(Error::ConvertTo {
|
_ => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "int".into(),
|
into: "int".into(),
|
||||||
|
@ -1867,7 +1867,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match v.parse::<f64>() {
|
Value::Strand(ref v) => match v.parse::<f64>() {
|
||||||
// The string can be represented as a Float
|
// The string can be represented as a Float
|
||||||
Ok(v) => Ok(Number::Float(v)),
|
Ok(v) => Ok(Number::Float(v)),
|
||||||
// Ths string is not a float
|
// This string is not a float
|
||||||
_ => Err(Error::ConvertTo {
|
_ => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "float".into(),
|
into: "float".into(),
|
||||||
|
@ -1890,7 +1890,7 @@ impl Value {
|
||||||
Value::Number(Number::Int(ref v)) => match Decimal::try_from(*v) {
|
Value::Number(Number::Int(ref v)) => match Decimal::try_from(*v) {
|
||||||
// The Int can be represented as a Decimal
|
// The Int can be represented as a Decimal
|
||||||
Ok(v) => Ok(Number::Decimal(v)),
|
Ok(v) => Ok(Number::Decimal(v)),
|
||||||
// Ths Int does not convert to a Decimal
|
// This Int does not convert to a Decimal
|
||||||
_ => Err(Error::ConvertTo {
|
_ => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "decimal".into(),
|
into: "decimal".into(),
|
||||||
|
@ -1900,7 +1900,7 @@ impl Value {
|
||||||
Value::Number(Number::Float(ref v)) => match Decimal::try_from(*v) {
|
Value::Number(Number::Float(ref v)) => match Decimal::try_from(*v) {
|
||||||
// The Float can be represented as a Decimal
|
// The Float can be represented as a Decimal
|
||||||
Ok(v) => Ok(Number::Decimal(v)),
|
Ok(v) => Ok(Number::Decimal(v)),
|
||||||
// Ths Float does not convert to a Decimal
|
// This Float does not convert to a Decimal
|
||||||
_ => Err(Error::ConvertTo {
|
_ => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "decimal".into(),
|
into: "decimal".into(),
|
||||||
|
@ -1910,7 +1910,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match Decimal::from_str(v) {
|
Value::Strand(ref v) => match Decimal::from_str(v) {
|
||||||
// The string can be represented as a Decimal
|
// The string can be represented as a Decimal
|
||||||
Ok(v) => Ok(Number::Decimal(v)),
|
Ok(v) => Ok(Number::Decimal(v)),
|
||||||
// Ths string is not a Decimal
|
// This string is not a Decimal
|
||||||
_ => Err(Error::ConvertTo {
|
_ => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "decimal".into(),
|
into: "decimal".into(),
|
||||||
|
@ -1933,7 +1933,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match Number::from_str(v) {
|
Value::Strand(ref v) => match Number::from_str(v) {
|
||||||
// The string can be represented as a Float
|
// The string can be represented as a Float
|
||||||
Ok(v) => Ok(v),
|
Ok(v) => Ok(v),
|
||||||
// Ths string is not a float
|
// This string is not a float
|
||||||
_ => Err(Error::ConvertTo {
|
_ => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "number".into(),
|
into: "number".into(),
|
||||||
|
@ -2008,7 +2008,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match Uuid::try_from(v.as_str()) {
|
Value::Strand(ref v) => match Uuid::try_from(v.as_str()) {
|
||||||
// The string can be represented as a uuid
|
// The string can be represented as a uuid
|
||||||
Ok(v) => Ok(v),
|
Ok(v) => Ok(v),
|
||||||
// Ths string is not a uuid
|
// This string is not a uuid
|
||||||
Err(_) => Err(Error::ConvertTo {
|
Err(_) => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "uuid".into(),
|
into: "uuid".into(),
|
||||||
|
@ -2031,7 +2031,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match Datetime::try_from(v.as_str()) {
|
Value::Strand(ref v) => match Datetime::try_from(v.as_str()) {
|
||||||
// The string can be represented as a datetime
|
// The string can be represented as a datetime
|
||||||
Ok(v) => Ok(v),
|
Ok(v) => Ok(v),
|
||||||
// Ths string is not a datetime
|
// This string is not a datetime
|
||||||
Err(_) => Err(Error::ConvertTo {
|
Err(_) => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "datetime".into(),
|
into: "datetime".into(),
|
||||||
|
@ -2054,7 +2054,7 @@ impl Value {
|
||||||
Value::Strand(ref v) => match Duration::try_from(v.as_str()) {
|
Value::Strand(ref v) => match Duration::try_from(v.as_str()) {
|
||||||
// The string can be represented as a duration
|
// The string can be represented as a duration
|
||||||
Ok(v) => Ok(v),
|
Ok(v) => Ok(v),
|
||||||
// Ths string is not a duration
|
// This string is not a duration
|
||||||
Err(_) => Err(Error::ConvertTo {
|
Err(_) => Err(Error::ConvertTo {
|
||||||
from: self,
|
from: self,
|
||||||
into: "duration".into(),
|
into: "duration".into(),
|
||||||
|
@ -2512,7 +2512,7 @@ impl Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compare this Value to another Value using natrual numerical comparison
|
/// Compare this Value to another Value using natural numerical comparison
|
||||||
pub fn natural_cmp(&self, other: &Value) -> Option<Ordering> {
|
pub fn natural_cmp(&self, other: &Value) -> Option<Ordering> {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(Value::Strand(a), Value::Strand(b)) => Some(lexicmp::natural_cmp(a, b)),
|
(Value::Strand(a), Value::Strand(b)) => Some(lexicmp::natural_cmp(a, b)),
|
||||||
|
@ -2520,7 +2520,7 @@ impl Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compare this Value to another Value lexicographically and using natrual numerical comparison
|
/// Compare this Value to another Value lexicographically and using natural numerical comparison
|
||||||
pub fn natural_lexical_cmp(&self, other: &Value) -> Option<Ordering> {
|
pub fn natural_lexical_cmp(&self, other: &Value) -> Option<Ordering> {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(Value::Strand(a), Value::Strand(b)) => Some(lexicmp::natural_lexical_cmp(a, b)),
|
(Value::Strand(a), Value::Strand(b)) => Some(lexicmp::natural_lexical_cmp(a, b)),
|
||||||
|
|
|
@ -38,7 +38,7 @@ mod api_integration {
|
||||||
const ROOT_USER: &str = "root";
|
const ROOT_USER: &str = "root";
|
||||||
const ROOT_PASS: &str = "root";
|
const ROOT_PASS: &str = "root";
|
||||||
const TICK_INTERVAL: Duration = Duration::from_secs(1);
|
const TICK_INTERVAL: Duration = Duration::from_secs(1);
|
||||||
// Used to ensure that only one test at a time is setting up the underlaying datastore.
|
// Used to ensure that only one test at a time is setting up the underlying datastore.
|
||||||
// When auth is enabled, multiple tests may try to create the same root user at the same time.
|
// When auth is enabled, multiple tests may try to create the same root user at the same time.
|
||||||
static SETUP_MUTEX: Lazy<Arc<Mutex<()>>> = Lazy::new(|| Arc::new(Mutex::new(())));
|
static SETUP_MUTEX: Lazy<Arc<Mutex<()>>> = Lazy::new(|| Arc::new(Mutex::new(())));
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ fn ok_graph_traversal_depth() -> Result<(), Error> {
|
||||||
ret.push_str(" AS res FROM node:0;\n");
|
ret.push_str(" AS res FROM node:0;\n");
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
// Test different traveral depths
|
// Test different traversal depths
|
||||||
for n in 1..=40 {
|
for n in 1..=40 {
|
||||||
// Ensure a good stack size for tests
|
// Ensure a good stack size for tests
|
||||||
with_enough_stack(async move {
|
with_enough_stack(async move {
|
||||||
|
|
|
@ -89,7 +89,7 @@ async fn concurrency() -> Result<(), Error> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` iif `limit` futures are concurrently executed.
|
/// Returns `true` if `limit` futures are concurrently executed.
|
||||||
async fn test_limit(limit: usize) -> Result<bool, Error> {
|
async fn test_limit(limit: usize) -> Result<bool, Error> {
|
||||||
let sql = query(limit, MILLIS);
|
let sql = query(limit, MILLIS);
|
||||||
let dbs = new_ds().await?;
|
let dbs = new_ds().await?;
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub enum ClientIp {
|
||||||
Socket,
|
Socket,
|
||||||
/// Cloudflare connecting IP
|
/// Cloudflare connecting IP
|
||||||
#[clap(name = "CF-Connecting-IP")]
|
#[clap(name = "CF-Connecting-IP")]
|
||||||
CfConectingIp,
|
CfConnectingIp,
|
||||||
/// Fly.io client IP
|
/// Fly.io client IP
|
||||||
#[clap(name = "Fly-Client-IP")]
|
#[clap(name = "Fly-Client-IP")]
|
||||||
FlyClientIp,
|
FlyClientIp,
|
||||||
|
@ -44,7 +44,7 @@ impl std::fmt::Display for ClientIp {
|
||||||
match self {
|
match self {
|
||||||
ClientIp::None => write!(f, "None"),
|
ClientIp::None => write!(f, "None"),
|
||||||
ClientIp::Socket => write!(f, "Socket"),
|
ClientIp::Socket => write!(f, "Socket"),
|
||||||
ClientIp::CfConectingIp => write!(f, "CF-Connecting-IP"),
|
ClientIp::CfConnectingIp => write!(f, "CF-Connecting-IP"),
|
||||||
ClientIp::FlyClientIp => write!(f, "Fly-Client-IP"),
|
ClientIp::FlyClientIp => write!(f, "Fly-Client-IP"),
|
||||||
ClientIp::TrueClientIP => write!(f, "True-Client-IP"),
|
ClientIp::TrueClientIP => write!(f, "True-Client-IP"),
|
||||||
ClientIp::XRealIp => write!(f, "X-Real-IP"),
|
ClientIp::XRealIp => write!(f, "X-Real-IP"),
|
||||||
|
@ -58,7 +58,7 @@ impl ClientIp {
|
||||||
match self {
|
match self {
|
||||||
ClientIp::None => false,
|
ClientIp::None => false,
|
||||||
ClientIp::Socket => false,
|
ClientIp::Socket => false,
|
||||||
ClientIp::CfConectingIp => true,
|
ClientIp::CfConnectingIp => true,
|
||||||
ClientIp::FlyClientIp => true,
|
ClientIp::FlyClientIp => true,
|
||||||
ClientIp::TrueClientIP => true,
|
ClientIp::TrueClientIP => true,
|
||||||
ClientIp::XRealIp => true,
|
ClientIp::XRealIp => true,
|
||||||
|
|
Loading…
Reference in a new issue