pub struct SortField {
pub field: String,
pub dir: SortDir,
}Expand description
Sort field with direction.
Fields§
§field: String§dir: SortDirImplementations§
Source§impl SortField
impl SortField
Sourcepub fn parse_sort_string(
sort: &str,
allowed: &[&str],
) -> Result<Vec<SortField>, String>
pub fn parse_sort_string( sort: &str, allowed: &[&str], ) -> Result<Vec<SortField>, String>
Parse a sort string like “name,-created_at” into sort fields.
Fields prefixed with - are sorted descending.
Validates against allowed fields list.
§Security Note
If allowed is empty, ALL fields are allowed. For user input, always
provide an explicit whitelist to prevent sorting by sensitive columns.
Trait Implementations§
impl Eq for SortField
impl StructuralPartialEq for SortField
Auto Trait Implementations§
impl Freeze for SortField
impl RefUnwindSafe for SortField
impl Send for SortField
impl Sync for SortField
impl Unpin for SortField
impl UnwindSafe for SortField
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