pub trait ArrayExprExt<'a>: Expr<'a, PostgresValue<'a>> + Sized {
// Provided methods
fn array_contains<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
where R: Expr<'a, PostgresValue<'a>>,
Self::SQLType: ArrayOperand<R::SQLType> { ... }
fn array_contained<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
where R: Expr<'a, PostgresValue<'a>>,
Self::SQLType: ArrayOperand<R::SQLType> { ... }
fn array_overlaps<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
where R: Expr<'a, PostgresValue<'a>>,
Self::SQLType: ArrayOperand<R::SQLType> { ... }
}Expand description
Method forms of the array operators, available on every PostgreSQL expression.
Each method calls the free function of the same name and has the same
operand rules (ArrayOperand).
§Examples
use drizzle_core::{ToSQL, expr::raw_non_null};
use drizzle_postgres::expr::{ArrayExprExt, PgArray};
use drizzle_postgres::values::PostgresValue;
use drizzle_types::{Array, postgres::types::Text};
let tags = raw_non_null::<PostgresValue, Array<Text>>("tags");
let condition = tags.array_overlaps(PgArray(vec!["rust"]));
assert_eq!(condition.to_sql().sql(), "tags && $1");Provided Methods§
Sourcefn array_contains<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
fn array_contains<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
Tests whether self contains every element of other (@>).
See array_contains.
Sourcefn array_contained<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
fn array_contained<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
Tests whether every element of self is in other (<@).
See array_contained.
Sourcefn array_overlaps<R>(
self,
other: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
fn array_overlaps<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, <Self::Aggregate as AggregateKind>::Or<R::Aggregate>, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
Tests whether self and other share at least one element (&&).
See array_overlaps.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".