Skip to main content

GqlFilter

Enum GqlFilter 

Source
pub enum GqlFilter {
    Field {
        column: String,
        op: FilterOp,
        value: Value,
    },
    Is {
        column: String,
        value: IsValue,
    },
    And(Vec<GqlFilter>),
    Or(Vec<GqlFilter>),
    Not(Box<GqlFilter>),
}
Expand description

A filter expression for GraphQL queries.

Maps to pg_graphql’s filter argument structure.

§Examples

use supabase_client_graphql::GqlFilter;

// Simple equality: { "title": { "eq": "hello" } }
let filter = GqlFilter::eq("title", "hello");

// Compound: { "and": [{ "age": { "gte": 18 } }, { "status": { "eq": "active" } }] }
let filter = GqlFilter::and(vec![
    GqlFilter::gte("age", 18),
    GqlFilter::eq("status", "active"),
]);

Variants§

§

Field

A field-level comparison: { column: { op: value } }.

Fields

§column: String
§value: Value
§

Is

An is filter for null/boolean checks: { column: { is: NULL } }.

Fields

§column: String
§value: IsValue
§

And(Vec<GqlFilter>)

Logical AND of multiple filters.

§

Or(Vec<GqlFilter>)

Logical OR of multiple filters.

§

Not(Box<GqlFilter>)

Logical NOT of a filter.

Implementations§

Source§

impl GqlFilter

Source

pub fn eq(column: impl Into<String>, value: impl Into<Value>) -> Self

Create an equality filter: { column: { eq: value } }.

Source

pub fn neq(column: impl Into<String>, value: impl Into<Value>) -> Self

Create a not-equal filter: { column: { neq: value } }.

Source

pub fn gt(column: impl Into<String>, value: impl Into<Value>) -> Self

Create a greater-than filter: { column: { gt: value } }.

Source

pub fn gte(column: impl Into<String>, value: impl Into<Value>) -> Self

Create a greater-than-or-equal filter: { column: { gte: value } }.

Source

pub fn lt(column: impl Into<String>, value: impl Into<Value>) -> Self

Create a less-than filter: { column: { lt: value } }.

Source

pub fn lte(column: impl Into<String>, value: impl Into<Value>) -> Self

Create a less-than-or-equal filter: { column: { lte: value } }.

Source

pub fn in_(column: impl Into<String>, values: Vec<Value>) -> Self

Create an in filter: { column: { in: [values] } }.

Source

pub fn is_null(column: impl Into<String>) -> Self

Create an is null filter: { column: { is: NULL } }.

Source

pub fn is_not_null(column: impl Into<String>) -> Self

Create an is not null filter: { column: { is: NOT_NULL } }.

Source

pub fn like(column: impl Into<String>, pattern: impl Into<String>) -> Self

Create a like filter: { column: { like: pattern } }.

Source

pub fn ilike(column: impl Into<String>, pattern: impl Into<String>) -> Self

Create an ilike (case-insensitive like) filter.

Source

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

Create a startsWith filter.

Source

pub fn and(filters: Vec<GqlFilter>) -> Self

Logical AND of multiple filters.

Source

pub fn or(filters: Vec<GqlFilter>) -> Self

Logical OR of multiple filters.

Source

pub fn not(filter: GqlFilter) -> Self

Logical NOT of a filter.

Source

pub fn to_value(&self) -> Value

Convert this filter to a serde_json::Value for inlining into the query.

Trait Implementations§

Source§

impl Clone for GqlFilter

Source§

fn clone(&self) -> GqlFilter

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 GqlFilter

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more