use super::*;
impl Delete {
pub(crate) fn from(target: impl Into<Source>) -> Self {
Self {
ctes: Vec::new(),
target: target.into(),
using: Vec::new(),
filter: None,
returning: Vec::new(),
}
}
#[inline]
pub fn with(mut self, cte: Cte) -> Self {
self.ctes.push(cte);
self
}
pub fn using(mut self, source: impl Into<Source>) -> Self {
self.using.push(source.into());
self
}
pub fn returning<T>(mut self, field: Field<T>) -> Self {
self.returning.push(select_item_for_field(field));
self
}
pub fn returning_as(mut self, expr: impl Into<ValueExpr>, alias: impl Into<String>) -> Self {
self.returning.push(SelectItem {
expr: expr.into(),
alias: Some(alias.into()),
});
self
}
#[inline]
pub fn returning_all(mut self) -> Self {
self.returning.clear();
push_all_source_fields(&self.target, &mut self.returning);
self
}
}
impl_filter_methods!(Delete);