refactor(tests): reformat code and update dependency management
- Reorganized import statements in adapter tests for better readability - Replaced or_insert_with(Vec::new) with or_default() in test closures - Updated Cargo.lock with new dependency versions and checksums - Added TLS features to tonic dependency configuration - Included sqlx, chrono, and uuid dependencies with specific features - Added jsonwebtoken and arc-swap as project dependencies - Reformatted assertion statements to comply with line length limits - Adjusted base64 import order in engine codec module - Updated protobuf include statement formatting
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//! Message repository — struct definition and pool accessor.
|
||||
//!
|
||||
//! CRUD operations are split across `message_create.rs` (writes)
|
||||
//! and `message_query.rs` (reads) as separate `impl` blocks.
|
||||
|
||||
use sqlx::PgPool;
|
||||
|
||||
/// Repository for message CRUD operations.
|
||||
///
|
||||
/// All queries use parameterized statements via sqlx.
|
||||
/// IDs are UUID v7 (time-ordered) for efficient cursor pagination.
|
||||
#[derive(Clone)]
|
||||
pub struct MessageRepo {
|
||||
pool: PgPool,
|
||||
}
|
||||
|
||||
impl MessageRepo {
|
||||
/// Create a new repository backed by the given connection pool.
|
||||
pub fn new(pool: PgPool) -> Self {
|
||||
Self { pool }
|
||||
}
|
||||
|
||||
/// Access the inner `PgPool` for advanced queries.
|
||||
pub fn pool(&self) -> &PgPool {
|
||||
&self.pool
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user