Skip to main content

Filter

Enum Filter 

Source
pub enum Filter {
    Condition {
        field: String,
        op: FilterOp,
    },
    And(Vec<Filter>),
    Or(Vec<Filter>),
    Not(Box<Filter>),
}
Expand description

Filtro de metadata con operadores lógicos.

Permite construir consultas complejas combinando condiciones simples con operadores AND/OR.

§Ejemplo

use minimemory::Filter;

// Filtro simple
let filter = Filter::eq("author", "Juan");

// Encadenamiento con AND
let filter = Filter::eq("category", "tech")
    .and(Filter::gte("score", 0.5f64));

// Encadenamiento con OR
let filter = Filter::eq("status", "published")
    .or(Filter::eq("status", "featured"));

// Múltiples filtros con all/any
let filter = Filter::all(vec![
    Filter::eq("category", "tech"),
    Filter::gte("score", 0.5f64),
]);

// Dot notation para campos anidados
let filter = Filter::eq("author.name", "Juan");

Variants§

§

Condition

Condición simple: campo + operador

Fields

§field: String
§

And(Vec<Filter>)

AND lógico: todas las condiciones deben cumplirse

§

Or(Vec<Filter>)

OR lógico: al menos una condición debe cumplirse

§

Not(Box<Filter>)

NOT lógico: invierte el resultado

Implementations§

Source§

impl Filter

Source

pub fn eq(field: impl Into<String>, value: impl Into<MetadataValue>) -> Self

Crea un filtro de igualdad simple.

§Ejemplo
use minimemory::query::Filter;
let filter = Filter::eq("author", "Juan");
Source

pub fn ne(field: impl Into<String>, value: impl Into<MetadataValue>) -> Self

Crea un filtro de desigualdad.

Source

pub fn gt(field: impl Into<String>, value: impl Into<MetadataValue>) -> Self

Crea un filtro “mayor que”.

Source

pub fn gte(field: impl Into<String>, value: impl Into<MetadataValue>) -> Self

Crea un filtro “mayor o igual que”.

Source

pub fn lt(field: impl Into<String>, value: impl Into<MetadataValue>) -> Self

Crea un filtro “menor que”.

Source

pub fn lte(field: impl Into<String>, value: impl Into<MetadataValue>) -> Self

Crea un filtro “menor o igual que”.

Source

pub fn range( field: impl Into<String>, min: Option<impl Into<MetadataValue>>, max: Option<impl Into<MetadataValue>>, ) -> Self

Crea un filtro de rango (min <= x <= max).

Source

pub fn in_list( field: impl Into<String>, values: Vec<impl Into<MetadataValue>>, ) -> Self

Crea un filtro “valor en lista”.

Source

pub fn not_in_list( field: impl Into<String>, values: Vec<impl Into<MetadataValue>>, ) -> Self

Crea un filtro “valor NO en lista”.

Source

pub fn contains(field: impl Into<String>, substr: impl Into<String>) -> Self

Crea un filtro “campo contiene substring”.

Source

pub fn starts_with(field: impl Into<String>, prefix: impl Into<String>) -> Self

Crea un filtro “campo empieza con”.

Source

pub fn ends_with(field: impl Into<String>, suffix: impl Into<String>) -> Self

Crea un filtro “campo termina con”.

Source

pub fn regex(field: impl Into<String>, pattern: impl Into<String>) -> Self

Crea un filtro de regex sobre un campo string.

§Ejemplo
use minimemory::Filter;

// Matches strings starting with "Hello"
Filter::regex("title", "^Hello");
Source

pub fn exists(field: impl Into<String>) -> Self

Crea un filtro “campo existe”.

Source

pub fn not_exists(field: impl Into<String>) -> Self

Crea un filtro “campo no existe”.

Source

pub fn not(filter: Filter) -> Self

Niega un filtro.

Source

pub fn and(self, other: Filter) -> Self

Combina este filtro con otro usando AND.

§Ejemplo
use minimemory::Filter;
let filter = Filter::eq("category", "tech")
    .and(Filter::gt("score", 0.5f64));
Source

pub fn or(self, other: Filter) -> Self

Combina este filtro con otro usando OR.

§Ejemplo
use minimemory::Filter;
let filter = Filter::eq("status", "published")
    .or(Filter::eq("status", "featured"));
Source

pub fn all(filters: Vec<Filter>) -> Self

Combina múltiples filtros con AND (versión estática).

Source

pub fn any(filters: Vec<Filter>) -> Self

Combina múltiples filtros con OR (versión estática).

Trait Implementations§

Source§

impl Clone for Filter

Source§

fn clone(&self) -> Filter

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 Debug for Filter

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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