aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-server-postgres/src
diff options
context:
space:
mode:
authorConrad Ludgate <conradludgate@gmail.com>2023-09-11 09:26:05 +0100
committerGitHub <noreply@github.com>2023-09-11 09:26:05 +0100
commitf90c01f702f6a98b041f766b6a1d857bc1b9afef (patch)
tree04a4755bd632abdcf398d0ce903163ed60a5a212 /atuin-server-postgres/src
parentUse `case` for Linux distro choice in `install.sh` (#1200) (diff)
downloadatuin-f90c01f702f6a98b041f766b6a1d857bc1b9afef.zip
replace chrono with time (#806)
* replace chrono with time * Fix test chrono usage --------- Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Diffstat (limited to 'atuin-server-postgres/src')
-rw-r--r--atuin-server-postgres/src/lib.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/atuin-server-postgres/src/lib.rs b/atuin-server-postgres/src/lib.rs
index aa523222..8f473d52 100644
--- a/atuin-server-postgres/src/lib.rs
+++ b/atuin-server-postgres/src/lib.rs
@@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize};
use sqlx::postgres::PgPoolOptions;
use sqlx::Row;
+use time::{OffsetDateTime, PrimitiveDateTime};
use tracing::instrument;
use wrappers::{DbHistory, DbRecord, DbSession, DbUser};
@@ -139,7 +140,7 @@ impl Database for Postgres {
)
.bind(user.id)
.bind(id)
- .bind(chrono::Utc::now().naive_utc())
+ .bind(OffsetDateTime::now_utc())
.fetch_all(&self.pool)
.await
.map_err(fix_error)?;
@@ -175,8 +176,8 @@ impl Database for Postgres {
async fn count_history_range(
&self,
user: &User,
- start: chrono::NaiveDateTime,
- end: chrono::NaiveDateTime,
+ start: PrimitiveDateTime,
+ end: PrimitiveDateTime,
) -> DbResult<i64> {
let res: (i64,) = sqlx::query_as(
"select count(1) from history
@@ -198,8 +199,8 @@ impl Database for Postgres {
async fn list_history(
&self,
user: &User,
- created_after: chrono::NaiveDateTime,
- since: chrono::NaiveDateTime,
+ created_after: OffsetDateTime,
+ since: OffsetDateTime,
host: &str,
page_size: i64,
) -> DbResult<Vec<History>> {