pub enum GraphqlCondition {
Field(FieldCondition),
DeferredField {
field: String,
op: GraphqlOp,
value_fn: DeferredFn<AnyGraphqlType>,
},
And(Vec<GraphqlCondition>),
Or(Vec<GraphqlCondition>),
Not(Box<GraphqlCondition>),
Deferred(DeferredFn<AnyGraphqlType>),
}Expand description
Structured filter for GraphQL requests. Built by the operator trait
(GraphqlOperation in operation.rs) and rendered at fetch time.
Variants§
Field(FieldCondition)
DeferredField
Like Self::Field but the value is resolved at fetch time.
Used by relationship traversal — with_many/with_one builds
one of these when the parent’s foreign-key value isn’t known
until the parent is fetched. The deferred resolves to a scalar
(the FK value); render-time wraps it in the dialect’s _eq-
equivalent and merges it into the filter.
And(Vec<GraphqlCondition>)
Or(Vec<GraphqlCondition>)
Not(Box<GraphqlCondition>)
Deferred(DeferredFn<AnyGraphqlType>)
Resolved at fetch time — produces a complete filter sub-object
that already matches the surrounding dialect. Use Self::DeferredField
instead unless you genuinely need to compute a non-field op value
shape dynamically.
Implementations§
Source§impl GraphqlCondition
impl GraphqlCondition
Sourcepub fn eq(field: impl Into<String>, value: impl Into<Value>) -> Self
pub fn eq(field: impl Into<String>, value: impl Into<Value>) -> Self
Build a simple field = value condition. Convenience for callers
that have a value already converted to JSON.
Sourcepub fn render<'a>(
&'a self,
dialect: FilterDialect,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'a>>
pub fn render<'a>( &'a self, dialect: FilterDialect, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'a>>
Render this condition as a JSON object suitable for use as a
GraphQL argument (typically the where: arg in Hasura, or the
find: arg in flat-argument schemas).
Deferred branches are resolved here. Resolution may make out-of-band fetches (e.g. for relationship traversal), so the method is async.
Trait Implementations§
Source§impl Clone for GraphqlCondition
impl Clone for GraphqlCondition
Source§fn clone(&self) -> GraphqlCondition
fn clone(&self) -> GraphqlCondition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphqlCondition
impl Debug for GraphqlCondition
Source§impl Expressive<AnyGraphqlType> for GraphqlCondition
GraphqlCondition is Expressive so it satisfies the blanket
bound on the operation trait — cond.eq(false) shape works the
same way as Mongo’s chaining.
impl Expressive<AnyGraphqlType> for GraphqlCondition
GraphqlCondition is Expressive so it satisfies the blanket
bound on the operation trait — cond.eq(false) shape works the
same way as Mongo’s chaining.
Source§fn expr(&self) -> Expression<AnyGraphqlType>
fn expr(&self) -> Expression<AnyGraphqlType>
Expression<T>. Read moreSource§impl From<FieldCondition> for GraphqlCondition
impl From<FieldCondition> for GraphqlCondition
Source§fn from(fc: FieldCondition) -> Self
fn from(fc: FieldCondition) -> Self
Source§impl Selectable<AnyGraphqlType, GraphqlCondition> for GraphqlSelect
impl Selectable<AnyGraphqlType, GraphqlCondition> for GraphqlSelect
Source§fn add_source(
&mut self,
source: impl Into<SourceRef<AnyGraphqlType>>,
_alias: Option<String>,
)
fn add_source( &mut self, source: impl Into<SourceRef<AnyGraphqlType>>, _alias: Option<String>, )
Source§fn add_expression(&mut self, _expression: impl Expressive<AnyGraphqlType>)
fn add_expression(&mut self, _expression: impl Expressive<AnyGraphqlType>)
Source§fn add_where_condition(&mut self, condition: impl Into<GraphqlCondition>)
fn add_where_condition(&mut self, condition: impl Into<GraphqlCondition>)
Source§fn set_distinct(&mut self, distinct: bool)
fn set_distinct(&mut self, distinct: bool)
Source§fn add_order_by(&mut self, order: impl Into<GraphqlCondition>, direction: Order)
fn add_order_by(&mut self, order: impl Into<GraphqlCondition>, direction: Order)
Source§fn add_group_by(&mut self, expression: impl Expressive<AnyGraphqlType>)
fn add_group_by(&mut self, expression: impl Expressive<AnyGraphqlType>)
Source§fn set_limit(&mut self, limit: Option<i64>, skip: Option<i64>)
fn set_limit(&mut self, limit: Option<i64>, skip: Option<i64>)
Source§fn clear_fields(&mut self)
fn clear_fields(&mut self)
Source§fn clear_where_conditions(&mut self)
fn clear_where_conditions(&mut self)
Source§fn clear_order_by(&mut self)
fn clear_order_by(&mut self)
Source§fn clear_group_by(&mut self)
fn clear_group_by(&mut self)
Source§fn has_fields(&self) -> bool
fn has_fields(&self) -> bool
Source§fn has_where_conditions(&self) -> bool
fn has_where_conditions(&self) -> bool
Source§fn has_order_by(&self) -> bool
fn has_order_by(&self) -> bool
Source§fn has_group_by(&self) -> bool
fn has_group_by(&self) -> bool
Source§fn is_distinct(&self) -> bool
fn is_distinct(&self) -> bool
Source§fn as_field(&self, _field: impl Into<String>) -> Expression<AnyGraphqlType>
fn as_field(&self, _field: impl Into<String>) -> Expression<AnyGraphqlType>
Source§fn as_count(&self) -> Expression<AnyGraphqlType>
fn as_count(&self) -> Expression<AnyGraphqlType>
Source§fn as_sum(
&self,
column: impl Expressive<AnyGraphqlType>,
) -> Expression<AnyGraphqlType>
fn as_sum( &self, column: impl Expressive<AnyGraphqlType>, ) -> Expression<AnyGraphqlType>
Source§fn as_max(
&self,
column: impl Expressive<AnyGraphqlType>,
) -> Expression<AnyGraphqlType>
fn as_max( &self, column: impl Expressive<AnyGraphqlType>, ) -> Expression<AnyGraphqlType>
Source§fn as_min(
&self,
column: impl Expressive<AnyGraphqlType>,
) -> Expression<AnyGraphqlType>
fn as_min( &self, column: impl Expressive<AnyGraphqlType>, ) -> Expression<AnyGraphqlType>
Source§fn with_source(self, source: impl Into<SourceRef<T>>) -> Selfwhere
Self: Sized,
fn with_source(self, source: impl Into<SourceRef<T>>) -> Selfwhere
Self: Sized,
Self::add_source without alias.Source§fn with_source_as(
self,
source: impl Into<SourceRef<T>>,
alias: impl Into<String>,
) -> Selfwhere
Self: Sized,
fn with_source_as(
self,
source: impl Into<SourceRef<T>>,
alias: impl Into<String>,
) -> Selfwhere
Self: Sized,
Self::add_source with alias.Source§fn with_condition(self, condition: impl Into<C>) -> Selfwhere
Self: Sized,
fn with_condition(self, condition: impl Into<C>) -> Selfwhere
Self: Sized,
Self::add_where_condition.Source§fn with_order(self, order: impl Into<C>, direction: Order) -> Selfwhere
Self: Sized,
fn with_order(self, order: impl Into<C>, direction: Order) -> Selfwhere
Self: Sized,
Self::add_order_by.Source§fn with_field(self, field: impl Into<String>) -> Selfwhere
Self: Sized,
fn with_field(self, field: impl Into<String>) -> Selfwhere
Self: Sized,
Self::add_field.Source§fn with_expression(self, expression: impl Expressive<T>) -> Selfwhere
Self: Sized,
fn with_expression(self, expression: impl Expressive<T>) -> Selfwhere
Self: Sized,
Self::add_expression.Source§fn with_group_by(self, expression: impl Expressive<T>) -> Selfwhere
Self: Sized,
fn with_group_by(self, expression: impl Expressive<T>) -> Selfwhere
Self: Sized,
Self::add_group_by.Source§fn with_distinct(self, distinct: bool) -> Selfwhere
Self: Sized,
fn with_distinct(self, distinct: bool) -> Selfwhere
Self: Sized,
Self::set_distinct.Source§fn with_limit(self, limit: Option<i64>, skip: Option<i64>) -> Selfwhere
Self: Sized,
fn with_limit(self, limit: Option<i64>, skip: Option<i64>) -> Selfwhere
Self: Sized,
Self::set_limit.Source§impl SelectableDataSource<AnyGraphqlType, GraphqlCondition> for GraphqlApi
impl SelectableDataSource<AnyGraphqlType, GraphqlCondition> for GraphqlApi
type Select = GraphqlSelect
fn select(&self) -> Self::Select
Source§fn add_select_column(
&self,
select: &mut Self::Select,
_expression: Expression<AnyGraphqlType>,
alias: Option<&str>,
)
fn add_select_column( &self, select: &mut Self::Select, _expression: Expression<AnyGraphqlType>, alias: Option<&str>, )
async fn execute_select( &self, select: &Self::Select, ) -> Result<Vec<AnyGraphqlType>>
Auto Trait Implementations§
impl !RefUnwindSafe for GraphqlCondition
impl !UnwindSafe for GraphqlCondition
impl Freeze for GraphqlCondition
impl Send for GraphqlCondition
impl Sync for GraphqlCondition
impl Unpin for GraphqlCondition
impl UnsafeUnpin for GraphqlCondition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ColumnType for T
Source§impl<T> ExpressionLike for T
impl<T> ExpressionLike for T
Source§fn clone_box(&self) -> Box<dyn ExpressionLike>
fn clone_box(&self) -> Box<dyn ExpressionLike>
Source§impl<T, S> GraphqlOperation<T> for Swhere
S: Expressive<T>,
impl<T, S> GraphqlOperation<T> for Swhere
S: Expressive<T>,
Source§fn eq(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
fn eq(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
field = valueSource§fn ne(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
fn ne(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
field != valueSource§fn gt(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
fn gt(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
field > valueSource§fn gte(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
fn gte(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
field >= valueSource§fn lt(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
fn lt(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
field < valueSource§fn lte(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
fn lte(&self, value: impl Into<AnyGraphqlType>) -> GraphqlConditionwhere
Self: Sized,
field <= valueSource§fn in_<I, V>(&self, values: I) -> GraphqlCondition
fn in_<I, V>(&self, values: I) -> GraphqlCondition
field IN [values...]Source§fn not_in<I, V>(&self, values: I) -> GraphqlCondition
fn not_in<I, V>(&self, values: I) -> GraphqlCondition
field NOT IN [values...]Source§fn like(&self, pattern: impl Into<String>) -> GraphqlConditionwhere
Self: Sized,
fn like(&self, pattern: impl Into<String>) -> GraphqlConditionwhere
Self: Sized,
field LIKE pattern — case-sensitive substring match.Source§fn ilike(&self, pattern: impl Into<String>) -> GraphqlConditionwhere
Self: Sized,
fn ilike(&self, pattern: impl Into<String>) -> GraphqlConditionwhere
Self: Sized,
field ILIKE pattern — case-insensitive substring match.Source§fn is_null(&self) -> GraphqlConditionwhere
Self: Sized,
fn is_null(&self) -> GraphqlConditionwhere
Self: Sized,
field IS NULLSource§fn is_not_null(&self) -> GraphqlConditionwhere
Self: Sized,
fn is_not_null(&self) -> GraphqlConditionwhere
Self: Sized,
field IS NOT NULLSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more