aboutsummaryrefslogtreecommitdiffstats
path: root/crates/server/src/database
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-20 18:23:39 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-20 18:24:17 +0200
commit0bcb8e7bd8aefb089ad88f5ebfd7364ae81cdf06 (patch)
tree83e098b147f25670ff15f7bcd1ac72dc1115b3b6 /crates/server/src/database
parentchore: Remove some warnings (cargo fix) (diff)
downloadatuin-0bcb8e7bd8aefb089ad88f5ebfd7364ae81cdf06.zip
chore(server): Remove warnings
Diffstat (limited to 'crates/server/src/database')
-rw-r--r--crates/server/src/database/db/mod.rs10
-rw-r--r--crates/server/src/database/db/wrappers.rs2
-rw-r--r--crates/server/src/database/mod.rs18
-rw-r--r--crates/server/src/database/models.rs4
4 files changed, 17 insertions, 17 deletions
diff --git a/crates/server/src/database/db/mod.rs b/crates/server/src/database/db/mod.rs
index c95a2ed4..9345ff6b 100644
--- a/crates/server/src/database/db/mod.rs
+++ b/crates/server/src/database/db/mod.rs
@@ -15,7 +15,7 @@ mod wrappers;
const MIN_PG_VERSION: u32 = 14;
#[derive(Clone)]
-pub struct ServerPostgres {
+pub(crate) struct ServerPostgres {
pool: sqlx::Pool<sqlx::postgres::Postgres>,
/// Optional read replica pool for read-only queries
read_pool: Option<sqlx::Pool<sqlx::postgres::Postgres>>,
@@ -30,7 +30,7 @@ impl ServerPostgres {
}
impl ServerPostgres {
- pub async fn new(settings: &DbSettings) -> DbResult<Self> {
+ pub(crate) async fn new(settings: &DbSettings) -> DbResult<Self> {
let pool = PgPoolOptions::new()
.max_connections(100)
.connect(settings.db_uri.as_str())
@@ -91,7 +91,7 @@ impl ServerPostgres {
}
#[instrument(skip_all)]
- pub async fn add_records(
+ pub(crate) async fn add_records(
&self,
user: &User,
records: &[Record<EncryptedData>],
@@ -167,7 +167,7 @@ impl ServerPostgres {
}
#[instrument(skip_all)]
- pub async fn next_records(
+ pub(crate) async fn next_records(
&self,
user: &User,
host: HostId,
@@ -220,7 +220,7 @@ impl ServerPostgres {
Ok(ret)
}
- pub async fn status(&self, user: &User) -> DbResult<RecordStatus> {
+ pub(crate) async fn status(&self, user: &User) -> DbResult<RecordStatus> {
// If IDX_CACHE_ROLLOUT is set, then we
// 1. Read the value of the var, use it as a % chance of using the cache
// 2. If we use the cache, just read from the cache table
diff --git a/crates/server/src/database/db/wrappers.rs b/crates/server/src/database/db/wrappers.rs
index 8054289a..6bacf47f 100644
--- a/crates/server/src/database/db/wrappers.rs
+++ b/crates/server/src/database/db/wrappers.rs
@@ -1,7 +1,7 @@
use turtle_common::record::{EncryptedData, Host, Record};
use sqlx::{Row, postgres::PgRow};
-pub struct DbRecord(pub Record<EncryptedData>);
+pub(crate) struct DbRecord(pub(crate) Record<EncryptedData>);
impl<'a> ::sqlx::FromRow<'a, PgRow> for DbRecord {
fn from_row(row: &'a PgRow) -> ::sqlx::Result<Self> {
diff --git a/crates/server/src/database/mod.rs b/crates/server/src/database/mod.rs
index c05fa783..43fe5c3b 100644
--- a/crates/server/src/database/mod.rs
+++ b/crates/server/src/database/mod.rs
@@ -1,12 +1,12 @@
-pub mod db;
-pub mod models;
+pub(crate) mod db;
+pub(crate) mod models;
use std::fmt::{Debug, Display};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
-pub enum DbError {
+pub(crate) enum DbError {
NotFound,
Other(eyre::Report),
}
@@ -43,24 +43,24 @@ impl From<sqlx::Error> for DbError {
impl std::error::Error for DbError {}
-pub type DbResult<T> = Result<T, DbError>;
+pub(crate) type DbResult<T> = Result<T, DbError>;
#[derive(Debug, PartialEq)]
-pub enum DbType {
+pub(crate) enum DbType {
Postgres,
Unknown,
}
#[derive(Clone, Deserialize, Serialize)]
-pub struct DbSettings {
- pub db_uri: String,
+pub(crate) struct DbSettings {
+ pub(crate) db_uri: String,
/// Optional URI for read replicas. If set, read-only queries will use this connection.
- pub read_db_uri: Option<String>,
+ pub(crate) read_db_uri: Option<String>,
}
impl DbSettings {
- pub fn db_type(&self) -> DbType {
+ pub(crate) fn db_type(&self) -> DbType {
if self.db_uri.starts_with("postgres://") || self.db_uri.starts_with("postgresql://") {
DbType::Postgres
} else {
diff --git a/crates/server/src/database/models.rs b/crates/server/src/database/models.rs
index 9f6241ae..3fa6f471 100644
--- a/crates/server/src/database/models.rs
+++ b/crates/server/src/database/models.rs
@@ -1,5 +1,5 @@
use uuid::Uuid;
-pub struct User {
- pub id: Uuid,
+pub(crate) struct User {
+ pub(crate) id: Uuid,
}