cargo fmt

Also formatted SQL query, because rustfmt can't format statements with
too long strings.
This commit is contained in:
Alexander Krotov
2020-10-09 08:18:18 +03:00
committed by link2xt
parent 093839c2b0
commit 25274f13c3

View File

@@ -974,8 +974,26 @@ impl Chat {
// add message to the database // add message to the database
if context.sql.execute( if context
"INSERT INTO msgs (rfc724_mid, chat_id, from_id, to_id, timestamp, type, state, txt, param, hidden, mime_in_reply_to, mime_references, location_id, ephemeral_timer, ephemeral_timestamp) VALUES (?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?);", .sql
.execute(
"INSERT INTO msgs (
rfc724_mid,
chat_id,
from_id,
to_id,
timestamp,
type,
state,
txt,
param,
hidden,
mime_in_reply_to,
mime_references,
location_id,
ephemeral_timer,
ephemeral_timestamp)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);",
paramsv![ paramsv![
new_rfc724_mid, new_rfc724_mid,
self.id, self.id,
@@ -992,19 +1010,19 @@ impl Chat {
location_id as i32, location_id as i32,
ephemeral_timer, ephemeral_timer,
ephemeral_timestamp ephemeral_timestamp
] ],
).await.is_ok() { )
msg_id = context.sql.get_rowid( .await
context, .is_ok()
"msgs", {
"rfc724_mid", msg_id = context
new_rfc724_mid, .sql
).await?; .get_rowid(context, "msgs", "rfc724_mid", new_rfc724_mid)
.await?;
} else { } else {
error!( error!(
context, context,
"Cannot send message, cannot insert to database ({}).", "Cannot send message, cannot insert to database ({}).", self.id,
self.id,
); );
} }
schedule_ephemeral_task(context).await; schedule_ephemeral_task(context).await;