refactor(db): declare unixepoch instead of formatting a SQL fragment

This commit is contained in:
CleverWild
2026-08-27 14:08:48 +02:00
parent e9496da78c
commit 0d29d0d532
3 changed files with 18 additions and 6 deletions

View File

@@ -0,0 +1,12 @@
//! Typed bindings for the SQLite scalar functions used in Diesel expressions.
use diesel::sql_types::{Integer, Text};
diesel::define_sql_function! {
/// SQLite `unixepoch(modifier)` -- seconds since the Unix epoch.
///
/// Declared so timestamp comparisons are built by the query DSL instead of by
/// `format!`-ing a SQL fragment: the argument becomes a bind parameter and the
/// result type is checked against the column it is compared with.
fn unixepoch(modifier: Text) -> Integer;
}