mirror of
https://github.com/atuinsh/atuin.git
synced 2025-07-01 07:00:54 +02:00
replace chrono with time (#806)
* replace chrono with time * Fix test chrono usage --------- Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
This commit is contained in:
@ -14,7 +14,7 @@ atuin-common = { path = "../atuin-common", version = "16.0.0" }
|
||||
atuin-server-database = { path = "../atuin-server-database", version = "16.0.0" }
|
||||
|
||||
tracing = "0.1"
|
||||
chrono = { workspace = true }
|
||||
time = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
sqlx = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
|
@ -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>> {
|
||||
|
Reference in New Issue
Block a user