AbstractQuery

Enum AbstractQuery 

Source
pub enum AbstractQuery<K, V> {
    And(Vec<Self>),
    Or(Vec<Self>),
    Not(Box<Self>),
    Eq(K, V),
    Neq(K, V),
    Gt(K, V),
    Gte(K, V),
    Lt(K, V),
    Lte(K, V),
    Like(K, V),
    In(K, Vec<V>),
    Exist(Vec<K>),
}
Expand description

An abstract query representation over a key and value type

Variants§

§

And(Vec<Self>)

Logical AND of multiple clauses

§

Or(Vec<Self>)

Logical OR of multiple clauses

§

Not(Box<Self>)

Negation of a clause

§

Eq(K, V)

Equality comparison for a field value

§

Neq(K, V)

Inequality comparison for a field value

§

Gt(K, V)

Greater-than comparison for a field value

§

Gte(K, V)

Greater-than-or-equal comparison for a field value

§

Lt(K, V)

Less-than comparison for a field value

§

Lte(K, V)

Less-than-or-equal comparison for a field value

§

Like(K, V)

SQL ‘LIKE’-compatible string comparison for a field value

§

In(K, Vec<V>)

Match one of multiple field values in a set

§

Exist(Vec<K>)

Match any non-null field value of the given field names

Implementations§

Source§

impl<K, V> AbstractQuery<K, V>

Source

pub fn optimise(self) -> Option<Self>

Perform basic query clause optimization

Source

pub fn map_names<RK, E>( self, f: impl FnMut(K) -> Result<RK, E>, ) -> Result<AbstractQuery<RK, V>, E>

Perform a transformation on all field names in query clauses

Source

pub fn map_values<RV, E>( self, f: impl FnMut(&K, V) -> Result<RV, E>, ) -> Result<AbstractQuery<K, RV>, E>

Perform a transformation on all field values in query clauses

Source

pub fn map<RK, RV, KF, VF, E>( self, kf: &mut KF, vf: &mut VF, ) -> Result<AbstractQuery<RK, RV>, E>
where KF: FnMut(K) -> Result<RK, E>, VF: FnMut(&K, V) -> Result<RV, E>,

Transform all query clauses using field name and value conversions

Trait Implementations§

Source§

impl<K: Clone, V: Clone> Clone for AbstractQuery<K, V>

Source§

fn clone(&self) -> AbstractQuery<K, V>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Debug, V: Debug> Debug for AbstractQuery<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V> Default for AbstractQuery<K, V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K: Hash, V: Hash> Hash for AbstractQuery<K, V>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<K: Ord, V: Ord> Ord for AbstractQuery<K, V>

Source§

fn cmp(&self, other: &AbstractQuery<K, V>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<K: PartialEq, V: PartialEq> PartialEq for AbstractQuery<K, V>

Source§

fn eq(&self, other: &AbstractQuery<K, V>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K: PartialOrd, V: PartialOrd> PartialOrd for AbstractQuery<K, V>

Source§

fn partial_cmp(&self, other: &AbstractQuery<K, V>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<K, V> Serialize for AbstractQuery<K, V>
where for<'a> &'a K: Into<String>, V: Serialize,

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<K: Eq, V: Eq> Eq for AbstractQuery<K, V>

Source§

impl<K, V> StructuralPartialEq for AbstractQuery<K, V>

Auto Trait Implementations§

§

impl<K, V> Freeze for AbstractQuery<K, V>
where K: Freeze, V: Freeze,

§

impl<K, V> RefUnwindSafe for AbstractQuery<K, V>

§

impl<K, V> Send for AbstractQuery<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for AbstractQuery<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for AbstractQuery<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for AbstractQuery<K, V>
where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,