use std::time::Duration;
use crate::column_types::models::ColumnType;
use crate::schema_plan::models::DesiredColumn;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TableName {
pub database: Option<String>,
pub schema: String,
pub table: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum WriteMode {
Append,
Merge {
unique_key: Vec<String>,
},
DeleteInsert {
cursor_column: String,
from: Option<String>,
to: Option<String>,
values: Vec<String>,
},
Replace,
Recreate,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WriteStatementsRequest<'a> {
pub table: &'a TableName,
pub columns: &'a [DesiredColumn],
pub mode: &'a WriteMode,
pub hashed: &'a [String],
pub built: Option<&'a [String]>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TableShape {
pub definition: String,
pub indexes: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CursorQuery<'a> {
pub table: &'a TableName,
pub column: &'a str,
pub column_type: &'a ColumnType,
pub lookback: Option<Duration>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CursorValue {
EpochMicros { zoned: bool },
Date,
Plain,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CursorRead {
pub sql: String,
pub value: CursorValue,
}
#[derive(Debug, Clone, Copy)]
pub struct WriteTarget<'a> {
pub table: &'a TableName,
pub staging: Option<&'a TableName>,
pub columns: &'a [DesiredColumn],
pub load_id: &'a str,
pub batch: u64,
pub direct: bool,
pub builds: bool,
}