Update clippy linting tests
This commit is contained in:
parent
cf11eb7f54
commit
84b026679f
34 changed files with 158 additions and 165 deletions
|
@ -65,12 +65,12 @@ impl<'a> From<&'a InsertStatement> for Statement<'a> {
|
||||||
impl<'a> fmt::Display for Statement<'a> {
|
impl<'a> fmt::Display for Statement<'a> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Statement::Select(v) => write!(f, "{}", v),
|
Statement::Select(v) => write!(f, "{v}"),
|
||||||
Statement::Create(v) => write!(f, "{}", v),
|
Statement::Create(v) => write!(f, "{v}"),
|
||||||
Statement::Update(v) => write!(f, "{}", v),
|
Statement::Update(v) => write!(f, "{v}"),
|
||||||
Statement::Relate(v) => write!(f, "{}", v),
|
Statement::Relate(v) => write!(f, "{v}"),
|
||||||
Statement::Delete(v) => write!(f, "{}", v),
|
Statement::Delete(v) => write!(f, "{v}"),
|
||||||
Statement::Insert(v) => write!(f, "{}", v),
|
Statement::Insert(v) => write!(f, "{v}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub fn md5((arg,): (String,)) -> Result<Value, Error> {
|
||||||
let mut hasher = Md5::new();
|
let mut hasher = Md5::new();
|
||||||
hasher.update(arg.as_str());
|
hasher.update(arg.as_str());
|
||||||
let val = hasher.finalize();
|
let val = hasher.finalize();
|
||||||
let val = format!("{:x}", val);
|
let val = format!("{val:x}");
|
||||||
Ok(val.into())
|
Ok(val.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ pub fn sha1((arg,): (String,)) -> Result<Value, Error> {
|
||||||
let mut hasher = Sha1::new();
|
let mut hasher = Sha1::new();
|
||||||
hasher.update(arg.as_str());
|
hasher.update(arg.as_str());
|
||||||
let val = hasher.finalize();
|
let val = hasher.finalize();
|
||||||
let val = format!("{:x}", val);
|
let val = format!("{val:x}");
|
||||||
Ok(val.into())
|
Ok(val.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ pub fn sha256((arg,): (String,)) -> Result<Value, Error> {
|
||||||
let mut hasher = Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
hasher.update(arg.as_str());
|
hasher.update(arg.as_str());
|
||||||
let val = hasher.finalize();
|
let val = hasher.finalize();
|
||||||
let val = format!("{:x}", val);
|
let val = format!("{val:x}");
|
||||||
Ok(val.into())
|
Ok(val.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ pub fn sha512((arg,): (String,)) -> Result<Value, Error> {
|
||||||
let mut hasher = Sha512::new();
|
let mut hasher = Sha512::new();
|
||||||
hasher.update(arg.as_str());
|
hasher.update(arg.as_str());
|
||||||
let val = hasher.finalize();
|
let val = hasher.finalize();
|
||||||
let val = format!("{:x}", val);
|
let val = format!("{val:x}");
|
||||||
Ok(val.into())
|
Ok(val.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,12 +52,12 @@ pub fn guid((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error> {
|
||||||
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max as usize..=min as usize),
|
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max as usize..=min as usize),
|
||||||
_ => return Err(Error::InvalidArguments {
|
_ => return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::guid"),
|
name: String::from("rand::guid"),
|
||||||
message: format!("To generate a guid of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
message: format!("To generate a guid of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
_ => return Err(Error::InvalidArguments {
|
_ => return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::guid"),
|
name: String::from("rand::guid"),
|
||||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
} else if let Some(len) = arg1 {
|
} else if let Some(len) = arg1 {
|
||||||
|
@ -66,7 +66,7 @@ pub fn guid((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error> {
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::InvalidArguments {
|
return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::guid"),
|
name: String::from("rand::guid"),
|
||||||
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {}.", LIMIT),
|
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {LIMIT}."),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -100,12 +100,12 @@ pub fn string((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error>
|
||||||
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max as usize..=min as usize),
|
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max as usize..=min as usize),
|
||||||
_ => return Err(Error::InvalidArguments {
|
_ => return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::string"),
|
name: String::from("rand::string"),
|
||||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
_ => return Err(Error::InvalidArguments {
|
_ => return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::string"),
|
name: String::from("rand::string"),
|
||||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
} else if let Some(len) = arg1 {
|
} else if let Some(len) = arg1 {
|
||||||
|
@ -114,7 +114,7 @@ pub fn string((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error>
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::InvalidArguments {
|
return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::string"),
|
name: String::from("rand::string"),
|
||||||
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {}.", LIMIT),
|
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {LIMIT}."),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,12 +135,12 @@ pub fn time((range,): (Option<(i64, i64)>,)) -> Result<Value, Error> {
|
||||||
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max..=min),
|
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max..=min),
|
||||||
_ => return Err(Error::InvalidArguments {
|
_ => return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::time"),
|
name: String::from("rand::time"),
|
||||||
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
_ => return Err(Error::InvalidArguments {
|
_ => return Err(Error::InvalidArguments {
|
||||||
name: String::from("rand::time"),
|
name: String::from("rand::time"),
|
||||||
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,7 +12,7 @@ impl From<js::Error> for Error {
|
||||||
message: format!(
|
message: format!(
|
||||||
"An exception occurred{}: {}{}",
|
"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(),
|
||||||
},
|
},
|
||||||
match message.is_empty() {
|
match message.is_empty() {
|
||||||
|
@ -20,7 +20,7 @@ impl From<js::Error> for Error {
|
||||||
true => String::default(),
|
true => String::default(),
|
||||||
},
|
},
|
||||||
match stack.is_empty() {
|
match stack.is_empty() {
|
||||||
false => format!("\n{}", stack),
|
false => format!("\n{stack}"),
|
||||||
true => String::default(),
|
true => String::default(),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub fn repeat((val, num): (String, usize)) -> Result<Value, Error> {
|
||||||
if val.len().saturating_mul(num) > LIMIT {
|
if val.len().saturating_mul(num) > LIMIT {
|
||||||
Err(Error::InvalidArguments {
|
Err(Error::InvalidArguments {
|
||||||
name: String::from("string::repeat"),
|
name: String::from("string::repeat"),
|
||||||
message: format!("Output must not exceed {} bytes.", LIMIT),
|
message: format!("Output must not exceed {LIMIT} bytes."),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Ok(val.repeat(num).into())
|
Ok(val.repeat(num).into())
|
||||||
|
|
|
@ -1334,7 +1334,7 @@ impl Transaction {
|
||||||
chn.send(bytes!("-- ------------------------------")).await?;
|
chn.send(bytes!("-- ------------------------------")).await?;
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
for dl in dls.iter() {
|
for dl in dls.iter() {
|
||||||
chn.send(bytes!(format!("{};", dl))).await?;
|
chn.send(bytes!(format!("{dl};"))).await?;
|
||||||
}
|
}
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
}
|
}
|
||||||
|
@ -1348,7 +1348,7 @@ impl Transaction {
|
||||||
chn.send(bytes!("-- ------------------------------")).await?;
|
chn.send(bytes!("-- ------------------------------")).await?;
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
for dt in dts.iter() {
|
for dt in dts.iter() {
|
||||||
chn.send(bytes!(format!("{};", dt))).await?;
|
chn.send(bytes!(format!("{dt};"))).await?;
|
||||||
}
|
}
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
}
|
}
|
||||||
|
@ -1362,7 +1362,7 @@ impl Transaction {
|
||||||
chn.send(bytes!("-- ------------------------------")).await?;
|
chn.send(bytes!("-- ------------------------------")).await?;
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
for sc in scs.iter() {
|
for sc in scs.iter() {
|
||||||
chn.send(bytes!(format!("{};", sc))).await?;
|
chn.send(bytes!(format!("{sc};"))).await?;
|
||||||
}
|
}
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
}
|
}
|
||||||
|
@ -1376,7 +1376,7 @@ impl Transaction {
|
||||||
chn.send(bytes!("-- ------------------------------")).await?;
|
chn.send(bytes!("-- ------------------------------")).await?;
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
for pa in pas.iter() {
|
for pa in pas.iter() {
|
||||||
chn.send(bytes!(format!("{};", pa))).await?;
|
chn.send(bytes!(format!("{pa};"))).await?;
|
||||||
}
|
}
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
}
|
}
|
||||||
|
@ -1391,14 +1391,14 @@ impl Transaction {
|
||||||
chn.send(bytes!(format!("-- TABLE: {}", tb.name))).await?;
|
chn.send(bytes!(format!("-- TABLE: {}", tb.name))).await?;
|
||||||
chn.send(bytes!("-- ------------------------------")).await?;
|
chn.send(bytes!("-- ------------------------------")).await?;
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
chn.send(bytes!(format!("{};", tb))).await?;
|
chn.send(bytes!(format!("{tb};"))).await?;
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
// Output FIELDS
|
// Output FIELDS
|
||||||
{
|
{
|
||||||
let fds = self.all_fd(ns, db, &tb.name).await?;
|
let fds = self.all_fd(ns, db, &tb.name).await?;
|
||||||
if !fds.is_empty() {
|
if !fds.is_empty() {
|
||||||
for fd in fds.iter() {
|
for fd in fds.iter() {
|
||||||
chn.send(bytes!(format!("{};", fd))).await?;
|
chn.send(bytes!(format!("{fd};"))).await?;
|
||||||
}
|
}
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
}
|
}
|
||||||
|
@ -1407,7 +1407,7 @@ impl Transaction {
|
||||||
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() {
|
||||||
chn.send(bytes!(format!("{};", ix))).await?;
|
chn.send(bytes!(format!("{ix};"))).await?;
|
||||||
}
|
}
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
}
|
}
|
||||||
|
@ -1415,7 +1415,7 @@ impl Transaction {
|
||||||
let evs = self.all_ev(ns, db, &tb.name).await?;
|
let evs = self.all_ev(ns, db, &tb.name).await?;
|
||||||
if !evs.is_empty() {
|
if !evs.is_empty() {
|
||||||
for ev in evs.iter() {
|
for ev in evs.iter() {
|
||||||
chn.send(bytes!(format!("{};", ev))).await?;
|
chn.send(bytes!(format!("{ev};"))).await?;
|
||||||
}
|
}
|
||||||
chn.send(bytes!("")).await?;
|
chn.send(bytes!("")).await?;
|
||||||
}
|
}
|
||||||
|
@ -1473,15 +1473,12 @@ impl Transaction {
|
||||||
match (v.pick(&*EDGE), v.pick(&*IN), v.pick(&*OUT)) {
|
match (v.pick(&*EDGE), v.pick(&*IN), v.pick(&*OUT)) {
|
||||||
// This is a graph edge record
|
// This is a graph edge record
|
||||||
(Value::True, Value::Thing(l), Value::Thing(r)) => {
|
(Value::True, Value::Thing(l), Value::Thing(r)) => {
|
||||||
let sql = format!(
|
let sql = format!("RELATE {l} -> {t} -> {r} CONTENT {v};",);
|
||||||
"RELATE {} -> {} -> {} CONTENT {};",
|
|
||||||
l, t, r, v
|
|
||||||
);
|
|
||||||
chn.send(bytes!(sql)).await?;
|
chn.send(bytes!(sql)).await?;
|
||||||
}
|
}
|
||||||
// This is a normal record
|
// This is a normal record
|
||||||
_ => {
|
_ => {
|
||||||
let sql = format!("UPDATE {} CONTENT {};", t, v);
|
let sql = format!("UPDATE {t} CONTENT {v};");
|
||||||
chn.send(bytes!(sql)).await?;
|
chn.send(bytes!(sql)).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl fmt::Display for Base {
|
||||||
match self {
|
match self {
|
||||||
Self::Ns => f.write_str("NAMESPACE"),
|
Self::Ns => f.write_str("NAMESPACE"),
|
||||||
Self::Db => f.write_str("DATABASE"),
|
Self::Db => f.write_str("DATABASE"),
|
||||||
Self::Sc(sc) => write!(f, "SCOPE {}", sc),
|
Self::Sc(sc) => write!(f, "SCOPE {sc}"),
|
||||||
Self::Kv => f.write_str("KV"),
|
Self::Kv => f.write_str("KV"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,16 +80,14 @@ impl Display for Data {
|
||||||
Self::SetExpression(v) => write!(
|
Self::SetExpression(v) => write!(
|
||||||
f,
|
f,
|
||||||
"SET {}",
|
"SET {}",
|
||||||
Fmt::comma_separated(v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(
|
Fmt::comma_separated(
|
||||||
f,
|
v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(f, "{l} {o} {r}",)))
|
||||||
"{} {} {}",
|
)
|
||||||
l, o, r
|
|
||||||
))))
|
|
||||||
),
|
),
|
||||||
Self::PatchExpression(v) => write!(f, "PATCH {}", v),
|
Self::PatchExpression(v) => write!(f, "PATCH {v}"),
|
||||||
Self::MergeExpression(v) => write!(f, "MERGE {}", v),
|
Self::MergeExpression(v) => write!(f, "MERGE {v}"),
|
||||||
Self::ReplaceExpression(v) => write!(f, "REPLACE {}", v),
|
Self::ReplaceExpression(v) => write!(f, "REPLACE {v}"),
|
||||||
Self::ContentExpression(v) => write!(f, "CONTENT {}", v),
|
Self::ContentExpression(v) => write!(f, "CONTENT {v}"),
|
||||||
Self::SingleExpression(v) => Display::fmt(v, f),
|
Self::SingleExpression(v) => Display::fmt(v, f),
|
||||||
Self::ValuesExpression(v) => write!(
|
Self::ValuesExpression(v) => write!(
|
||||||
f,
|
f,
|
||||||
|
@ -104,11 +102,9 @@ impl Display for Data {
|
||||||
Self::UpdateExpression(v) => write!(
|
Self::UpdateExpression(v) => write!(
|
||||||
f,
|
f,
|
||||||
"ON DUPLICATE KEY UPDATE {}",
|
"ON DUPLICATE KEY UPDATE {}",
|
||||||
Fmt::comma_separated(v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(
|
Fmt::comma_separated(
|
||||||
f,
|
v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(f, "{l} {o} {r}",)))
|
||||||
"{} {} {}",
|
)
|
||||||
l, o, r
|
|
||||||
))))
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub fn escape_str(s: &str) -> Cow<'_, str> {
|
||||||
if s.contains(SINGLE) {
|
if s.contains(SINGLE) {
|
||||||
escape_normal(s, DOUBLE, DOUBLE, DOUBLE_ESC)
|
escape_normal(s, DOUBLE, DOUBLE, DOUBLE_ESC)
|
||||||
} else {
|
} else {
|
||||||
Cow::Owned(format!("{}{}{}", SINGLE, s, SINGLE))
|
Cow::Owned(format!("{SINGLE}{s}{SINGLE}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ pub fn escape_normal<'a>(s: &'a str, l: char, r: char, e: &str) -> Cow<'a, str>
|
||||||
for x in s.bytes() {
|
for x in s.bytes() {
|
||||||
// Check if character is allowed
|
// Check if character is allowed
|
||||||
if !val_u8(x) {
|
if !val_u8(x) {
|
||||||
return Cow::Owned(format!("{}{}{}", l, s.replace(r, e), r));
|
return Cow::Owned(format!("{l}{}{r}", s.replace(r, e)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Output the value
|
// Output the value
|
||||||
|
@ -62,7 +62,7 @@ pub fn escape_numeric<'a>(s: &'a str, l: char, r: char, e: &str) -> Cow<'a, str>
|
||||||
for x in s.bytes() {
|
for x in s.bytes() {
|
||||||
// Check if character is allowed
|
// Check if character is allowed
|
||||||
if !val_u8(x) {
|
if !val_u8(x) {
|
||||||
return Cow::Owned(format!("{}{}{}", l, s.replace(r, e), r));
|
return Cow::Owned(format!("{l}{}{r}", s.replace(r, e)));
|
||||||
}
|
}
|
||||||
// Check if character is non-numeric
|
// Check if character is non-numeric
|
||||||
if !is_digit(x) {
|
if !is_digit(x) {
|
||||||
|
@ -72,7 +72,7 @@ pub fn escape_numeric<'a>(s: &'a str, l: char, r: char, e: &str) -> Cow<'a, str>
|
||||||
// Output the id value
|
// Output the id value
|
||||||
match numeric {
|
match numeric {
|
||||||
// This is numeric so escape it
|
// This is numeric so escape it
|
||||||
true => Cow::Owned(format!("{}{}{}", l, s.replace(r, e), r)),
|
true => Cow::Owned(format!("{l}{}{r}", s.replace(r, e))),
|
||||||
// No need to escape the value
|
// No need to escape the value
|
||||||
_ => Cow::Borrowed(s),
|
_ => Cow::Borrowed(s),
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ impl Display for Field {
|
||||||
match self {
|
match self {
|
||||||
Self::All => f.write_char('*'),
|
Self::All => f.write_char('*'),
|
||||||
Self::Alone(e) => Display::fmt(e, f),
|
Self::Alone(e) => Display::fmt(e, f),
|
||||||
Self::Alias(e, a) => write!(f, "{} AS {}", e, a),
|
Self::Alias(e, a) => write!(f, "{e} AS {a}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,11 +151,11 @@ impl Function {
|
||||||
impl fmt::Display for Function {
|
impl fmt::Display for Function {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Cast(ref s, ref e) => write!(f, "<{}> {}", s, e),
|
Self::Cast(ref s, ref e) => write!(f, "<{s}> {e}"),
|
||||||
Self::Script(ref s, ref e) => {
|
Self::Script(ref s, ref e) => {
|
||||||
write!(f, "function({}) {{{}}}", Fmt::comma_separated(e), s)
|
write!(f, "function({}) {{{s}}}", Fmt::comma_separated(e))
|
||||||
}
|
}
|
||||||
Self::Normal(ref s, ref e) => write!(f, "{}({})", s, Fmt::comma_separated(e)),
|
Self::Normal(ref s, ref e) => write!(f, "{s}({})", Fmt::comma_separated(e)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ impl Display for Graph {
|
||||||
_ => Display::fmt(&self.what, f),
|
_ => Display::fmt(&self.what, f),
|
||||||
}?;
|
}?;
|
||||||
if let Some(ref v) = self.cond {
|
if let Some(ref v) = self.cond {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.alias {
|
if let Some(ref v) = self.alias {
|
||||||
write!(f, " AS {}", v)?
|
write!(f, " AS {v}")?
|
||||||
}
|
}
|
||||||
f.write_char(')')
|
f.write_char(')')
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl Idiom {
|
||||||
}
|
}
|
||||||
/// Convert this Idiom to a JSON Path string
|
/// Convert this Idiom to a JSON Path string
|
||||||
pub(crate) fn to_path(&self) -> String {
|
pub(crate) fn to_path(&self) -> String {
|
||||||
format!("/{}", self).replace(']', "").replace(&['.', '['][..], "/")
|
format!("/{self}").replace(']', "").replace(&['.', '['][..], "/")
|
||||||
}
|
}
|
||||||
/// Simplifies this Idiom for use in object keys
|
/// Simplifies this Idiom for use in object keys
|
||||||
pub(crate) fn simplify(&self) -> Idiom {
|
pub(crate) fn simplify(&self) -> Idiom {
|
||||||
|
|
|
@ -391,9 +391,9 @@ impl Number {
|
||||||
|
|
||||||
pub fn fixed(self, precision: usize) -> Number {
|
pub fn fixed(self, precision: usize) -> Number {
|
||||||
match self {
|
match self {
|
||||||
Number::Int(v) => format!("{:.1$}", v, precision).into(),
|
Number::Int(v) => format!("{v:.precision$}").into(),
|
||||||
Number::Float(v) => format!("{:.1$}", v, precision).into(),
|
Number::Float(v) => format!("{v:.precision$}").into(),
|
||||||
Number::Decimal(v) => format!("{:.1$}", v, precision).into(),
|
Number::Decimal(v) => format!("{v:.precision$}").into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,11 +106,11 @@ impl fmt::Display for Part {
|
||||||
Part::All => f.write_str("[*]"),
|
Part::All => f.write_str("[*]"),
|
||||||
Part::Last => f.write_str("[$]"),
|
Part::Last => f.write_str("[$]"),
|
||||||
Part::First => f.write_str("[0]"),
|
Part::First => f.write_str("[0]"),
|
||||||
Part::Field(v) => write!(f, ".{}", v),
|
Part::Field(v) => write!(f, ".{v}"),
|
||||||
Part::Index(v) => write!(f, "[{}]", v),
|
Part::Index(v) => write!(f, "[{v}]"),
|
||||||
Part::Where(v) => write!(f, "[WHERE {}]", v),
|
Part::Where(v) => write!(f, "[WHERE {v}]"),
|
||||||
Part::Thing(v) => write!(f, "{}", v),
|
Part::Thing(v) => write!(f, "{v}"),
|
||||||
Part::Graph(v) => write!(f, "{}", v),
|
Part::Graph(v) => write!(f, "{v}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ impl Display for Permissions {
|
||||||
let _indent = pretty_indent();
|
let _indent = pretty_indent();
|
||||||
Display::fmt(permission, f)?;
|
Display::fmt(permission, f)?;
|
||||||
}
|
}
|
||||||
_ => write!(f, " {}", permission)?,
|
_ => write!(f, " {permission}")?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drop(indent);
|
drop(indent);
|
||||||
|
@ -198,7 +198,7 @@ impl Display for Permission {
|
||||||
match self {
|
match self {
|
||||||
Self::None => f.write_str("NONE"),
|
Self::None => f.write_str("NONE"),
|
||||||
Self::Full => f.write_str("FULL"),
|
Self::Full => f.write_str("FULL"),
|
||||||
Self::Specific(ref v) => write!(f, "WHERE {}", v),
|
Self::Specific(ref v) => write!(f, "WHERE {v}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,13 +110,13 @@ impl fmt::Display for Range {
|
||||||
write!(f, "{}:", self.tb)?;
|
write!(f, "{}:", self.tb)?;
|
||||||
match &self.beg {
|
match &self.beg {
|
||||||
Bound::Unbounded => write!(f, ""),
|
Bound::Unbounded => write!(f, ""),
|
||||||
Bound::Included(id) => write!(f, "{}", id),
|
Bound::Included(id) => write!(f, "{id}"),
|
||||||
Bound::Excluded(id) => write!(f, "{}>", id),
|
Bound::Excluded(id) => write!(f, "{id}>"),
|
||||||
}?;
|
}?;
|
||||||
match &self.end {
|
match &self.end {
|
||||||
Bound::Unbounded => write!(f, ".."),
|
Bound::Unbounded => write!(f, ".."),
|
||||||
Bound::Excluded(id) => write!(f, "..{}", id),
|
Bound::Excluded(id) => write!(f, "..{id}"),
|
||||||
Bound::Included(id) => write!(f, "..={}", id),
|
Bound::Included(id) => write!(f, "..={id}"),
|
||||||
}?;
|
}?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl fmt::Display for Statements {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
Display::fmt(
|
Display::fmt(
|
||||||
&Fmt::pretty_new_line_separated(
|
&Fmt::pretty_new_line_separated(
|
||||||
self.0.iter().map(|v| Fmt::new(v, |v, f| write!(f, "{};", v))),
|
self.0.iter().map(|v| Fmt::new(v, |v, f| write!(f, "{v};"))),
|
||||||
),
|
),
|
||||||
f,
|
f,
|
||||||
)
|
)
|
||||||
|
@ -152,25 +152,25 @@ impl Statement {
|
||||||
impl Display for Statement {
|
impl Display for Statement {
|
||||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Use(v) => write!(Pretty::from(f), "{}", v),
|
Self::Use(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Set(v) => write!(Pretty::from(f), "{}", v),
|
Self::Set(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Info(v) => write!(Pretty::from(f), "{}", v),
|
Self::Info(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Live(v) => write!(Pretty::from(f), "{}", v),
|
Self::Live(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Kill(v) => write!(Pretty::from(f), "{}", v),
|
Self::Kill(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Begin(v) => write!(Pretty::from(f), "{}", v),
|
Self::Begin(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Cancel(v) => write!(Pretty::from(f), "{}", v),
|
Self::Cancel(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Commit(v) => write!(Pretty::from(f), "{}", v),
|
Self::Commit(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Output(v) => write!(Pretty::from(f), "{}", v),
|
Self::Output(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Ifelse(v) => write!(Pretty::from(f), "{}", v),
|
Self::Ifelse(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Select(v) => write!(Pretty::from(f), "{}", v),
|
Self::Select(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Create(v) => write!(Pretty::from(f), "{}", v),
|
Self::Create(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Update(v) => write!(Pretty::from(f), "{}", v),
|
Self::Update(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Relate(v) => write!(Pretty::from(f), "{}", v),
|
Self::Relate(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Delete(v) => write!(Pretty::from(f), "{}", v),
|
Self::Delete(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Insert(v) => write!(Pretty::from(f), "{}", v),
|
Self::Insert(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Define(v) => write!(Pretty::from(f), "{}", v),
|
Self::Define(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Remove(v) => write!(Pretty::from(f), "{}", v),
|
Self::Remove(v) => write!(Pretty::from(f), "{v}"),
|
||||||
Self::Option(v) => write!(Pretty::from(f), "{}", v),
|
Self::Option(v) => write!(Pretty::from(f), "{v}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,13 +121,13 @@ impl fmt::Display for CreateStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "CREATE {}", self.what)?;
|
write!(f, "CREATE {}", self.what)?;
|
||||||
if let Some(ref v) = self.data {
|
if let Some(ref v) = self.data {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.output {
|
if let Some(ref v) = self.output {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.timeout {
|
if let Some(ref v) = self.timeout {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if self.parallel {
|
if self.parallel {
|
||||||
f.write_str(" PARALLEL")?
|
f.write_str(" PARALLEL")?
|
||||||
|
|
|
@ -492,13 +492,13 @@ impl fmt::Display for DefineScopeStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "DEFINE SCOPE {}", self.name)?;
|
write!(f, "DEFINE SCOPE {}", self.name)?;
|
||||||
if let Some(ref v) = self.session {
|
if let Some(ref v) = self.session {
|
||||||
write!(f, " SESSION {}", v)?
|
write!(f, " SESSION {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.signup {
|
if let Some(ref v) = self.signup {
|
||||||
write!(f, " SIGNUP {}", v)?
|
write!(f, " SIGNUP {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.signin {
|
if let Some(ref v) = self.signin {
|
||||||
write!(f, " SIGNIN {}", v)?
|
write!(f, " SIGNIN {v}")?
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ impl fmt::Display for DefineTableStatement {
|
||||||
" SCHEMALESS"
|
" SCHEMALESS"
|
||||||
})?;
|
})?;
|
||||||
if let Some(ref v) = self.view {
|
if let Some(ref v) = self.view {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if !self.permissions.is_full() {
|
if !self.permissions.is_full() {
|
||||||
let _indent = if is_pretty() {
|
let _indent = if is_pretty() {
|
||||||
|
@ -951,13 +951,13 @@ impl fmt::Display for DefineFieldStatement {
|
||||||
write!(f, " FLEXIBLE")?
|
write!(f, " FLEXIBLE")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.kind {
|
if let Some(ref v) = self.kind {
|
||||||
write!(f, " TYPE {}", v)?
|
write!(f, " TYPE {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.value {
|
if let Some(ref v) = self.value {
|
||||||
write!(f, " VALUE {}", v)?
|
write!(f, " VALUE {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.assert {
|
if let Some(ref v) = self.assert {
|
||||||
write!(f, " ASSERT {}", v)?
|
write!(f, " ASSERT {v}")?
|
||||||
}
|
}
|
||||||
if !self.permissions.is_full() {
|
if !self.permissions.is_full() {
|
||||||
write!(f, " {}", self.permissions)?;
|
write!(f, " {}", self.permissions)?;
|
||||||
|
|
|
@ -115,13 +115,13 @@ impl fmt::Display for DeleteStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "DELETE {}", self.what)?;
|
write!(f, "DELETE {}", self.what)?;
|
||||||
if let Some(ref v) = self.cond {
|
if let Some(ref v) = self.cond {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.output {
|
if let Some(ref v) = self.output {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.timeout {
|
if let Some(ref v) = self.timeout {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if self.parallel {
|
if self.parallel {
|
||||||
f.write_str(" PARALLEL")?
|
f.write_str(" PARALLEL")?
|
||||||
|
|
|
@ -55,14 +55,14 @@ impl Display for IfelseStatement {
|
||||||
Display::fmt(
|
Display::fmt(
|
||||||
&Fmt::new(
|
&Fmt::new(
|
||||||
self.exprs.iter().map(|args| {
|
self.exprs.iter().map(|args| {
|
||||||
Fmt::new(args, |(cond, then), f| write!(f, "IF {} THEN {}", cond, then))
|
Fmt::new(args, |(cond, then), f| write!(f, "IF {cond} THEN {then}"))
|
||||||
}),
|
}),
|
||||||
fmt_separated_by(" ELSE "),
|
fmt_separated_by(" ELSE "),
|
||||||
),
|
),
|
||||||
f,
|
f,
|
||||||
)?;
|
)?;
|
||||||
if let Some(ref v) = self.close {
|
if let Some(ref v) = self.close {
|
||||||
write!(f, " ELSE {}", v)?
|
write!(f, " ELSE {v}")?
|
||||||
}
|
}
|
||||||
f.write_str(" END")?;
|
f.write_str(" END")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -197,8 +197,8 @@ impl fmt::Display for InfoStatement {
|
||||||
Self::Kv => f.write_str("INFO FOR KV"),
|
Self::Kv => f.write_str("INFO FOR KV"),
|
||||||
Self::Ns => f.write_str("INFO FOR NAMESPACE"),
|
Self::Ns => f.write_str("INFO FOR NAMESPACE"),
|
||||||
Self::Db => f.write_str("INFO FOR DATABASE"),
|
Self::Db => f.write_str("INFO FOR DATABASE"),
|
||||||
Self::Sc(ref s) => write!(f, "INFO FOR SCOPE {}", s),
|
Self::Sc(ref s) => write!(f, "INFO FOR SCOPE {s}"),
|
||||||
Self::Tb(ref t) => write!(f, "INFO FOR TABLE {}", t),
|
Self::Tb(ref t) => write!(f, "INFO FOR TABLE {t}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,10 +112,10 @@ impl fmt::Display for InsertStatement {
|
||||||
}
|
}
|
||||||
write!(f, " INTO {} {}", self.into, self.data)?;
|
write!(f, " INTO {} {}", self.into, self.data)?;
|
||||||
if let Some(ref v) = self.output {
|
if let Some(ref v) = self.output {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.timeout {
|
if let Some(ref v) = self.timeout {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if self.parallel {
|
if self.parallel {
|
||||||
f.write_str(" PARALLEL")?
|
f.write_str(" PARALLEL")?
|
||||||
|
|
|
@ -73,10 +73,10 @@ impl fmt::Display for LiveStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "LIVE SELECT {} FROM {}", self.expr, self.what)?;
|
write!(f, "LIVE SELECT {} FROM {}", self.expr, self.what)?;
|
||||||
if let Some(ref v) = self.cond {
|
if let Some(ref v) = self.cond {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.fetch {
|
if let Some(ref v) = self.fetch {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl fmt::Display for OutputStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "RETURN {}", self.what)?;
|
write!(f, "RETURN {}", self.what)?;
|
||||||
if let Some(ref v) = self.fetch {
|
if let Some(ref v) = self.fetch {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,13 +182,13 @@ impl fmt::Display for RelateStatement {
|
||||||
f.write_str(" UNIQUE")?
|
f.write_str(" UNIQUE")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.data {
|
if let Some(ref v) = self.data {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.output {
|
if let Some(ref v) = self.output {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.timeout {
|
if let Some(ref v) = self.timeout {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if self.parallel {
|
if self.parallel {
|
||||||
f.write_str(" PARALLEL")?
|
f.write_str(" PARALLEL")?
|
||||||
|
|
|
@ -130,31 +130,31 @@ impl fmt::Display for SelectStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "SELECT {} FROM {}", self.expr, self.what)?;
|
write!(f, "SELECT {} FROM {}", self.expr, self.what)?;
|
||||||
if let Some(ref v) = self.cond {
|
if let Some(ref v) = self.cond {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.split {
|
if let Some(ref v) = self.split {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.group {
|
if let Some(ref v) = self.group {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.order {
|
if let Some(ref v) = self.order {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.limit {
|
if let Some(ref v) = self.limit {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.start {
|
if let Some(ref v) = self.start {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.fetch {
|
if let Some(ref v) = self.fetch {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.version {
|
if let Some(ref v) = self.version {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.timeout {
|
if let Some(ref v) = self.timeout {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if self.parallel {
|
if self.parallel {
|
||||||
f.write_str(" PARALLEL")?
|
f.write_str(" PARALLEL")?
|
||||||
|
|
|
@ -116,16 +116,16 @@ impl fmt::Display for UpdateStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "UPDATE {}", self.what)?;
|
write!(f, "UPDATE {}", self.what)?;
|
||||||
if let Some(ref v) = self.data {
|
if let Some(ref v) = self.data {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.cond {
|
if let Some(ref v) = self.cond {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.output {
|
if let Some(ref v) = self.output {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.timeout {
|
if let Some(ref v) = self.timeout {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if self.parallel {
|
if self.parallel {
|
||||||
f.write_str(" PARALLEL")?
|
f.write_str(" PARALLEL")?
|
||||||
|
|
|
@ -17,10 +17,10 @@ impl fmt::Display for UseStatement {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
f.write_str("USE")?;
|
f.write_str("USE")?;
|
||||||
if let Some(ref ns) = self.ns {
|
if let Some(ref ns) = self.ns {
|
||||||
write!(f, " NS {}", ns)?;
|
write!(f, " NS {ns}")?;
|
||||||
}
|
}
|
||||||
if let Some(ref db) = self.db {
|
if let Some(ref db) = self.db {
|
||||||
write!(f, " DB {}", db)?;
|
write!(f, " DB {db}")?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,13 +174,13 @@ impl Subquery {
|
||||||
impl Display for Subquery {
|
impl Display for Subquery {
|
||||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Value(v) => write!(f, "({})", v),
|
Self::Value(v) => write!(f, "({v})"),
|
||||||
Self::Select(v) => write!(f, "({})", v),
|
Self::Select(v) => write!(f, "({v})"),
|
||||||
Self::Create(v) => write!(f, "({})", v),
|
Self::Create(v) => write!(f, "({v})"),
|
||||||
Self::Update(v) => write!(f, "({})", v),
|
Self::Update(v) => write!(f, "({v})"),
|
||||||
Self::Delete(v) => write!(f, "({})", v),
|
Self::Delete(v) => write!(f, "({v})"),
|
||||||
Self::Relate(v) => write!(f, "({})", v),
|
Self::Relate(v) => write!(f, "({v})"),
|
||||||
Self::Insert(v) => write!(f, "({})", v),
|
Self::Insert(v) => write!(f, "({v})"),
|
||||||
Self::Ifelse(v) => Display::fmt(v, f),
|
Self::Ifelse(v) => Display::fmt(v, f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1294,27 +1294,27 @@ impl fmt::Display for Value {
|
||||||
Value::Null => write!(f, "NULL"),
|
Value::Null => write!(f, "NULL"),
|
||||||
Value::True => write!(f, "true"),
|
Value::True => write!(f, "true"),
|
||||||
Value::False => write!(f, "false"),
|
Value::False => write!(f, "false"),
|
||||||
Value::Number(v) => write!(f, "{}", v),
|
Value::Number(v) => write!(f, "{v}"),
|
||||||
Value::Strand(v) => write!(f, "{}", v),
|
Value::Strand(v) => write!(f, "{v}"),
|
||||||
Value::Duration(v) => write!(f, "{}", v),
|
Value::Duration(v) => write!(f, "{v}"),
|
||||||
Value::Datetime(v) => write!(f, "{}", v),
|
Value::Datetime(v) => write!(f, "{v}"),
|
||||||
Value::Uuid(v) => write!(f, "{}", v),
|
Value::Uuid(v) => write!(f, "{v}"),
|
||||||
Value::Array(v) => write!(f, "{}", v),
|
Value::Array(v) => write!(f, "{v}"),
|
||||||
Value::Object(v) => write!(f, "{}", v),
|
Value::Object(v) => write!(f, "{v}"),
|
||||||
Value::Geometry(v) => write!(f, "{}", v),
|
Value::Geometry(v) => write!(f, "{v}"),
|
||||||
Value::Param(v) => write!(f, "{}", v),
|
Value::Param(v) => write!(f, "{v}"),
|
||||||
Value::Idiom(v) => write!(f, "{}", v),
|
Value::Idiom(v) => write!(f, "{v}"),
|
||||||
Value::Table(v) => write!(f, "{}", v),
|
Value::Table(v) => write!(f, "{v}"),
|
||||||
Value::Thing(v) => write!(f, "{}", v),
|
Value::Thing(v) => write!(f, "{v}"),
|
||||||
Value::Model(v) => write!(f, "{}", v),
|
Value::Model(v) => write!(f, "{v}"),
|
||||||
Value::Regex(v) => write!(f, "{}", v),
|
Value::Regex(v) => write!(f, "{v}"),
|
||||||
Value::Range(v) => write!(f, "{}", v),
|
Value::Range(v) => write!(f, "{v}"),
|
||||||
Value::Edges(v) => write!(f, "{}", v),
|
Value::Edges(v) => write!(f, "{v}"),
|
||||||
Value::Future(v) => write!(f, "{}", v),
|
Value::Future(v) => write!(f, "{v}"),
|
||||||
Value::Constant(v) => write!(f, "{}", v),
|
Value::Constant(v) => write!(f, "{v}"),
|
||||||
Value::Function(v) => write!(f, "{}", v),
|
Value::Function(v) => write!(f, "{v}"),
|
||||||
Value::Subquery(v) => write!(f, "{}", v),
|
Value::Subquery(v) => write!(f, "{v}"),
|
||||||
Value::Expression(v) => write!(f, "{}", v),
|
Value::Expression(v) => write!(f, "{v}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,10 @@ impl fmt::Display for View {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "AS SELECT {} FROM {}", self.expr, self.what)?;
|
write!(f, "AS SELECT {} FROM {}", self.expr, self.what)?;
|
||||||
if let Some(ref v) = self.cond {
|
if let Some(ref v) = self.cond {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
if let Some(ref v) = self.group {
|
if let Some(ref v) = self.group {
|
||||||
write!(f, " {}", v)?
|
write!(f, " {v}")?
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ impl Rpc {
|
||||||
// We've received a message from the client
|
// We've received a message from the client
|
||||||
Ok(msg) => match msg {
|
Ok(msg) => match msg {
|
||||||
msg if msg.is_ping() => {
|
msg if msg.is_ping() => {
|
||||||
let _ = chn.send(Message::pong(vec![]));
|
let _ = chn.send(Message::pong(vec![])).await;
|
||||||
}
|
}
|
||||||
msg if msg.is_text() => {
|
msg if msg.is_text() => {
|
||||||
tokio::task::spawn(Rpc::call(rpc.clone(), msg, chn.clone()));
|
tokio::task::spawn(Rpc::call(rpc.clone(), msg, chn.clone()));
|
||||||
|
|
Loading…
Reference in a new issue