aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-server/src/database.rs
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2023-05-21 16:21:51 +0100
committerGitHub <noreply@github.com>2023-05-21 15:21:51 +0000
commitd2240e1163a62f96dfb1cb99c38ffa2390d53c33 (patch)
treef25616f3855d7f79df9d7d548c901796e136f557 /atuin-server/src/database.rs
parentRestructure account commands to account subcommand (#984) (diff)
downloadatuin-d2240e1163a62f96dfb1cb99c38ffa2390d53c33.zip
Allow server configured page size (#994)
* Allow server configured page size * Backwards compat via semver checks * Correct header name
Diffstat (limited to '')
-rw-r--r--atuin-server/src/database.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/atuin-server/src/database.rs b/atuin-server/src/database.rs
index e7057f6b..894fab7b 100644
--- a/atuin-server/src/database.rs
+++ b/atuin-server/src/database.rs
@@ -14,7 +14,6 @@ use super::{
models::{History, NewHistory, NewSession, NewUser, Session, User},
};
use crate::settings::Settings;
-use crate::settings::HISTORY_PAGE_SIZE;
use atuin_common::utils::get_days_from_month;
@@ -51,6 +50,7 @@ pub trait Database {
created_after: chrono::NaiveDateTime,
since: chrono::NaiveDateTime,
host: &str,
+ page_size: i64,
) -> Result<Vec<History>>;
async fn add_history(&self, history: &[NewHistory]) -> Result<()>;
@@ -271,6 +271,7 @@ impl Database for Postgres {
created_after: chrono::NaiveDateTime,
since: chrono::NaiveDateTime,
host: &str,
+ page_size: i64,
) -> Result<Vec<History>> {
let res = sqlx::query_as::<_, History>(
"select id, client_id, user_id, hostname, timestamp, data, created_at from history
@@ -285,7 +286,7 @@ impl Database for Postgres {
.bind(host)
.bind(created_after)
.bind(since)
- .bind(HISTORY_PAGE_SIZE)
+ .bind(page_size)
.fetch_all(&self.pool)
.await?;