sea_query/table/
truncate.rsuse inherent::inherent;
use crate::{backend::SchemaBuilder, types::*, SchemaStatementBuilder};
#[derive(Default, Debug, Clone)]
pub struct TableTruncateStatement {
pub(crate) table: Option<TableRef>,
}
impl TableTruncateStatement {
pub fn new() -> Self {
Self::default()
}
pub fn table<T>(&mut self, table: T) -> &mut Self
where
T: IntoTableRef,
{
self.table = Some(table.into_table_ref());
self
}
pub fn take(&mut self) -> Self {
Self {
table: self.table.take(),
}
}
}
#[inherent]
impl SchemaStatementBuilder for TableTruncateStatement {
pub fn build<T: SchemaBuilder>(&self, schema_builder: T) -> String {
let mut sql = String::with_capacity(256);
schema_builder.prepare_table_truncate_statement(self, &mut sql);
sql
}
pub fn build_any(&self, schema_builder: &dyn SchemaBuilder) -> String {
let mut sql = String::with_capacity(256);
schema_builder.prepare_table_truncate_statement(self, &mut sql);
sql
}
pub fn to_string<T: SchemaBuilder>(&self, schema_builder: T) -> String;
}