From 27cf6d2af5ae1a4884164d3b0ca44fbbf4a8fab1 Mon Sep 17 00:00:00 2001 From: John Oxley Date: Fri, 15 May 2026 00:07:08 +0100 Subject: refactor: pull `fn into_utc` into atuin-server-database crate (#3487) The `fn into_utc` was defined in both `atuin-server-postgres` and `atuin-server-sqlite`, with tests being in the postgres crate. This pulls the function into the `atuin-server-database` crate along with the tests and references it from both crates. ## Checks - [X] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [X] I have checked that there are no existing pull requests for the same thing --- crates/atuin-server-sqlite/src/lib.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'crates/atuin-server-sqlite/src/lib.rs') diff --git a/crates/atuin-server-sqlite/src/lib.rs b/crates/atuin-server-sqlite/src/lib.rs index 7d4dcb86..56ed9b6c 100644 --- a/crates/atuin-server-sqlite/src/lib.rs +++ b/crates/atuin-server-sqlite/src/lib.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use async_trait::async_trait; use atuin_common::record::{EncryptedData, HostId, Record, RecordIdx, RecordStatus}; use atuin_server_database::{ - Database, DbError, DbResult, DbSettings, + Database, DbError, DbResult, DbSettings, into_utc, models::{History, NewHistory, NewSession, NewUser, Session, User}, }; use futures_util::TryStreamExt; @@ -12,7 +12,6 @@ use sqlx::{ sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePoolOptions}, types::Uuid, }; -use time::{OffsetDateTime, PrimitiveDateTime, UtcOffset}; use tracing::instrument; use wrappers::{DbHistory, DbRecord, DbSession, DbUser}; @@ -429,8 +428,3 @@ impl Database for Sqlite { .map(|DbHistory(h)| h) } } - -fn into_utc(x: OffsetDateTime) -> PrimitiveDateTime { - let x = x.to_offset(UtcOffset::UTC); - PrimitiveDateTime::new(x.date(), x.time()) -} -- cgit v1.3.1