use crate::SelectStatement;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct TableSample {
pub method: SampleMethod,
pub percentage: f64,
pub repeatable: Option<f64>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SampleMethod {
BERNOULLI,
SYSTEM,
}
pub trait PostgresSelectStatementExt {
fn table_sample(
&mut self,
method: SampleMethod,
percentage: f64,
repeatable: Option<f64>,
) -> &mut Self;
}
impl PostgresSelectStatementExt for SelectStatement {
fn table_sample(
&mut self,
method: SampleMethod,
percentage: f64,
repeatable: Option<f64>,
) -> &mut Self {
self.table_sample = Some(TableSample {
method,
percentage,
repeatable,
});
self
}
}