pub enum FileCondition {
Compare {
attribute: FileAttribute,
operator: ComparisonOperator,
value: FileValue,
},
And(Box<FileCondition>, Box<FileCondition>),
Or(Box<FileCondition>, Box<FileCondition>),
Not(Box<FileCondition>),
Like {
attribute: FileAttribute,
pattern: String,
case_sensitive: bool,
},
Between {
attribute: FileAttribute,
lower: FileValue,
upper: FileValue,
},
Regexp {
attribute: FileAttribute,
pattern: String,
},
}Expand description
Represents a condition for filtering files.
This enum represents the various types of conditions that can appear in the WHERE clause of a query, including simple comparisons, logical operations, and pattern matching.
§Examples
use fmql::sql::ast::{FileCondition, FileAttribute, ComparisonOperator, FileValue};
// WHERE size > 1000000
let condition = FileCondition::Compare {
attribute: FileAttribute::Size,
operator: ComparisonOperator::Gt,
value: FileValue::Number(1000000.0),
};
// WHERE name LIKE '%.txt'
let text_files = FileCondition::Like {
attribute: FileAttribute::Name,
pattern: "%.txt".to_string(),
case_sensitive: false,
};
// Complex condition: WHERE (size > 1000000 AND extension = 'pdf')
let complex = FileCondition::And(
Box::new(condition),
Box::new(FileCondition::Compare {
attribute: FileAttribute::Extension,
operator: ComparisonOperator::Eq,
value: FileValue::String("pdf".to_string()),
})
);Variants§
Compare
Compares a file attribute to a value.
Fields
§
attribute: FileAttributeThe attribute to compare.
§
operator: ComparisonOperatorThe comparison operator.
And(Box<FileCondition>, Box<FileCondition>)
A logical AND of multiple conditions.
Or(Box<FileCondition>, Box<FileCondition>)
A logical OR of multiple conditions.
Not(Box<FileCondition>)
A logical NOT of a condition.
Like
A LIKE pattern matching condition.
Fields
§
attribute: FileAttributeThe attribute to match.
Between
A BETWEEN condition (value is between two bounds).
Fields
§
attribute: FileAttributeThe attribute to check.
Regexp
A regular expression matching condition.
Fields
§
attribute: FileAttributeThe attribute to match.
Trait Implementations§
Source§impl Clone for FileCondition
impl Clone for FileCondition
Source§fn clone(&self) -> FileCondition
fn clone(&self) -> FileCondition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileCondition
impl Debug for FileCondition
Source§impl<'de> Deserialize<'de> for FileCondition
impl<'de> Deserialize<'de> for FileCondition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FileCondition
impl RefUnwindSafe for FileCondition
impl Send for FileCondition
impl Sync for FileCondition
impl Unpin for FileCondition
impl UnsafeUnpin for FileCondition
impl UnwindSafe for FileCondition
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