pub struct Unique { /* private fields */ }Expand description
A transform that removes duplicate rows based on specified columns.
§Example
ⓘ
use alimentar::Unique;
// Keep only unique rows based on all columns
let unique = Unique::all();
// Keep only unique rows based on specific columns
let unique = Unique::by(vec!["user_id", "date"]);
// Keep first occurrence (default) or last
let unique = Unique::by(vec!["id"]).keep_first();
let unique = Unique::by(vec!["id"]).keep_last();Implementations§
Source§impl Unique
impl Unique
Sourcepub fn by<S: Into<String>>(columns: impl IntoIterator<Item = S>) -> Self
pub fn by<S: Into<String>>(columns: impl IntoIterator<Item = S>) -> Self
Creates a Unique transform that considers specific columns.
Sourcepub fn keep_first(self) -> Self
pub fn keep_first(self) -> Self
Keep the first occurrence of duplicates (default).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Unique
impl RefUnwindSafe for Unique
impl Send for Unique
impl Sync for Unique
impl Unpin for Unique
impl UnwindSafe for Unique
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more