refactor(tkg): extract shared t() function to schema module
- Create src/core/db/schema.rs with t() and table_name() functions - Remove duplicate t() from tkg.rs and trace_agent_api.rs - postgres_db.rs uses schema::table_name() from shared module
This commit is contained in:
@@ -6,6 +6,7 @@ use std::path::Path;
|
||||
|
||||
use crate::core::db::postgres_db::PostgresDb;
|
||||
use crate::core::db::redis_client::RedisClient;
|
||||
use crate::core::db::schema::t;
|
||||
use crate::core::progress::{publish_tkg_progress, TkgPhase, TkgProgress, TkgStats};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -121,14 +122,6 @@ async fn build_node_id_map(pool: &PgPool, file_uuid: &str) -> HashMap<(String, S
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn t(name: &str) -> String {
|
||||
let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "dev".to_string());
|
||||
if schema == "public" {
|
||||
name.to_string()
|
||||
} else {
|
||||
format!("{}.{}", schema, name)
|
||||
}
|
||||
}
|
||||
|
||||
// ── Phase 0: Populate trace_id from face.json ───────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user