mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 08:56:29 +03:00
sql: cleanup usage of ToSql
Moved custom ToSql trait including Send + Sync from lib.rs to sql.rs. Replaced most params! and paramsv! macro usage with tuples. Replaced paramsv! and params_iterv! with params_slice!, because there is no need to construct a vector.
This commit is contained in:
@@ -75,7 +75,7 @@ async fn lookup_host_with_cache(
|
||||
VALUES (?, ?, ?)
|
||||
ON CONFLICT (hostname, address)
|
||||
DO UPDATE SET timestamp=excluded.timestamp",
|
||||
paramsv![hostname, ip_string, now],
|
||||
(hostname, ip_string, now),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ async fn lookup_host_with_cache(
|
||||
WHERE hostname = ?
|
||||
AND ? < timestamp + 30 * 24 * 3600
|
||||
ORDER BY timestamp DESC",
|
||||
paramsv![hostname, now],
|
||||
(hostname, now),
|
||||
|row| {
|
||||
let address: String = row.get(0)?;
|
||||
Ok(address)
|
||||
@@ -157,7 +157,7 @@ pub(crate) async fn connect_tcp(
|
||||
"UPDATE dns_cache
|
||||
SET timestamp = ?
|
||||
WHERE address = ?",
|
||||
paramsv![time(), resolved_addr.ip().to_string()],
|
||||
(time(), resolved_addr.ip().to_string()),
|
||||
)
|
||||
.await?;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user