Skip to main content

Method

Enum Method 

Source
pub enum Method {
Show 88 variants Equal, NotEqual, LessThan, LessThanEqual, GreaterThan, GreaterThanEqual, Contains, ContainsAny, NotContains, Search, NotSearch, IsNull, IsNotNull, Between, NotBetween, StartsWith, NotStartsWith, EndsWith, NotEndsWith, Regex, Exists, NotExists, Crosses, NotCrosses, DistanceEqual, DistanceNotEqual, DistanceGreaterThan, DistanceLessThan, Intersects, NotIntersects, Overlaps, NotOverlaps, Touches, NotTouches, VectorDot, VectorCosine, VectorEuclidean, Select, OrderDesc, OrderAsc, OrderRandom, Limit, Offset, CursorAfter, CursorBefore, And, Or, ContainsAll, ElemMatch, Relationship, Count, CountDistinct, Sum, Avg, Min, Max, Stddev, StddevPop, StddevSamp, Variance, VarPop, VarSamp, BitAnd, BitOr, BitXor, GroupBy, GroupByTimeBucket, Having, Distinct, Join, LeftJoin, RightJoin, CrossJoin, FullOuterJoin, NaturalJoin, On, Union, UnionAll, JsonContains, JsonNotContains, JsonOverlaps, JsonPath, OrderVectorDistance, Covers, NotCovers, SpatialEquals, NotSpatialEquals, Raw,
}
Expand description

What a Query does: filter, order, paginate, select, aggregate, join, combine, or carry raw SQL.

PHP: Utopia\Query\Method.

Variants§

§

Equal

equal: the attribute is one of the values.

§

NotEqual

notEqual: the attribute is none of the values.

§

LessThan

lessThan.

§

LessThanEqual

lessThanEqual.

§

GreaterThan

greaterThan.

§

GreaterThanEqual

greaterThanEqual.

§

Contains

contains: substring (or array element) match.

§

ContainsAny

containsAny: any of the values.

§

NotContains

notContains.

§

Search

search: full-text search.

§

NotSearch

notSearch.

§

IsNull

isNull.

§

IsNotNull

isNotNull.

§

Between

between.

§

NotBetween

notBetween.

§

StartsWith

startsWith.

§

NotStartsWith

notStartsWith.

§

EndsWith

endsWith.

§

NotEndsWith

notEndsWith.

§

Regex

regex.

§

Exists

exists: the attributes are present.

§

NotExists

notExists.

§

Crosses

crosses (spatial).

§

NotCrosses

notCrosses (spatial).

§

DistanceEqual

distanceEqual (spatial).

§

DistanceNotEqual

distanceNotEqual (spatial).

§

DistanceGreaterThan

distanceGreaterThan (spatial).

§

DistanceLessThan

distanceLessThan (spatial).

§

Intersects

intersects (spatial).

§

NotIntersects

notIntersects (spatial).

§

Overlaps

overlaps (spatial).

§

NotOverlaps

notOverlaps (spatial).

§

Touches

touches (spatial).

§

NotTouches

notTouches (spatial).

§

VectorDot

vectorDot (vector similarity).

§

VectorCosine

vectorCosine (vector similarity).

§

VectorEuclidean

vectorEuclidean (vector similarity).

§

Select

select: the columns to return.

§

OrderDesc

orderDesc.

§

OrderAsc

orderAsc.

§

OrderRandom

orderRandom.

§

Limit

limit.

§

Offset

offset.

§

CursorAfter

cursorAfter: page after a row.

§

CursorBefore

cursorBefore: page before a row.

§

And

and.

§

Or

or.

§

ContainsAll

containsAll.

§

ElemMatch

elemMatch: an array element matches every nested query.

§

Relationship

relationship: queries, written against the related collection, that shape the documents populated for a relationship attribute.

§

Count

count.

§

CountDistinct

countDistinct.

§

Sum

sum.

§

Avg

avg.

§

Min

min.

§

Max

max.

§

Stddev

stddev.

§

StddevPop

stddevPop.

§

StddevSamp

stddevSamp.

§

Variance

variance.

§

VarPop

varPop.

§

VarSamp

varSamp.

§

BitAnd

bitAnd.

§

BitOr

bitOr.

§

BitXor

bitXor.

§

GroupBy

groupBy.

§

GroupByTimeBucket

groupByTimeBucket.

§

Having

having.

§

Distinct

distinct.

§

Join

join (inner).

§

LeftJoin

leftJoin.

§

RightJoin

rightJoin.

§

CrossJoin

crossJoin.

§

FullOuterJoin

fullOuterJoin.

§

NaturalJoin

naturalJoin.

§

On

on: a column-to-column join condition.

§

Union

union.

§

UnionAll

unionAll.

§

JsonContains

jsonContains.

§

JsonNotContains

jsonNotContains.

§

JsonOverlaps

jsonOverlaps.

§

JsonPath

jsonPath.

§

OrderVectorDistance

orderVectorDistance.

§

Covers

covers (spatial).

§

NotCovers

notCovers (spatial).

§

SpatialEquals

spatialEquals (spatial).

§

NotSpatialEquals

notSpatialEquals (spatial).

§

Raw

raw: SQL used as given.

Implementations§

Source§

impl Method

Source

pub const CASES: &'static [Method]

Every case, in declaration order.

PHP: cases().

Source

pub const PHP_CLASS: &'static str = "Utopia\\Query\\Method"

The PHP class of this enumeration.

Source

pub const fn as_str(self) -> &'static str

The backing value.

PHP: ->value.

Source

pub const fn name(self) -> &'static str

The case name.

PHP: ->name.

Source

pub fn try_from_value(value: &str) -> Option<Self>

The case with backing value value, if any.

PHP: tryFrom().

Source

pub fn from_value(value: &str) -> Result<Self, Error>

The case with backing value value.

PHP: from(), which throws ValueError (Error::InvalidValue) with the same message.

Source

pub fn from_name(name: &str) -> Option<Self>

The case named name, if any.

Source§

impl Method

Source

pub fn is_filter(self) -> bool

Whether this is a comparison filter (equal through notExists).

PHP: isFilter().

Source

pub fn is_spatial(self) -> bool

Whether this is a spatial predicate.

PHP: isSpatial().

Source

pub fn is_vector(self) -> bool

Whether this is a vector similarity filter.

PHP: isVector().

Source

pub fn is_json(self) -> bool

Whether this is a JSON filter.

PHP: isJson().

Source

pub fn is_nested(self) -> bool

Whether queries of this method hold other queries.

PHP: isNested().

Source

pub fn is_aggregate(self) -> bool

Whether this is an aggregate.

PHP: isAggregate().

Source

pub fn is_join_condition(self) -> bool

Whether a join’s ON list may hold this method: on column comparisons, the filters every builder compiles inside ON, and and/or of those.

PHP: isJoinCondition().

Source

pub fn is_join(self) -> bool

Whether this is a join.

PHP: isJoin().

Source

pub fn sql_function(self) -> Option<&'static str>

The standard SQL function of an aggregate (SUM, COUNT, …), or None when the method has no direct mapping.

PHP: sqlFunction().

use utopia_query::Method;

assert_eq!(Method::StddevPop.sql_function(), Some("STDDEV_POP"));
assert_eq!(Method::Equal.sql_function(), None);
use Utopia\Query\Method;

echo Method::StddevPop->sqlFunction(), "\n"; // STDDEV_POP
var_dump(Method::Equal->sqlFunction());      // NULL

Trait Implementations§

Source§

impl Clone for Method

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Method

Source§

impl Debug for Method

Source§

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

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

impl Display for Method

Source§

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

The backing value.

Source§

impl Eq for Method

Source§

impl Hash for Method

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 PartialEq for Method

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Method

Auto Trait Implementations§

§

impl Forget for Method

§

impl Freeze for Method

§

impl Move for Method

§

impl RefUnwindSafe for Method

§

impl Send for Method

§

impl Sync for Method

§

impl Unpin for Method

§

impl UnsafeUnpin for Method

§

impl UnwindSafe for Method

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.