mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-30 08:20:33 +00:00
66 lines
1.4 KiB
Rust
66 lines
1.4 KiB
Rust
pub mod clickhouse_driver;
|
|
pub mod mongo_driver;
|
|
pub mod mysql;
|
|
pub mod oracle_driver;
|
|
pub mod postgres;
|
|
pub mod redis_driver;
|
|
pub mod sqlite;
|
|
pub mod sqlserver;
|
|
pub mod ssh_tunnel;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct DatabaseInfo {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct TableInfo {
|
|
pub name: String,
|
|
pub table_type: String, // "TABLE" or "VIEW"
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ColumnInfo {
|
|
pub name: String,
|
|
pub data_type: String,
|
|
pub is_nullable: bool,
|
|
pub column_default: Option<String>,
|
|
pub is_primary_key: bool,
|
|
pub extra: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct QueryResult {
|
|
pub columns: Vec<String>,
|
|
pub rows: Vec<Vec<serde_json::Value>>,
|
|
pub affected_rows: u64,
|
|
pub execution_time_ms: u128,
|
|
#[serde(default)]
|
|
pub truncated: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct IndexInfo {
|
|
pub name: String,
|
|
pub columns: Vec<String>,
|
|
pub is_unique: bool,
|
|
pub is_primary: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ForeignKeyInfo {
|
|
pub name: String,
|
|
pub column: String,
|
|
pub ref_table: String,
|
|
pub ref_column: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct TriggerInfo {
|
|
pub name: String,
|
|
pub event: String,
|
|
pub timing: String,
|
|
}
|