pub struct AnyQuery { /* private fields */ }Expand description
A query over a table, named by strings.
Implementations§
Source§impl AnyQuery
impl AnyQuery
Sourcepub fn new(
schema: Arc<Schema>,
table: impl Into<String>,
system: System,
) -> Self
pub fn new( schema: Arc<Schema>, table: impl Into<String>, system: System, ) -> Self
All rows of table, for the system system (an app uses
System::Client).
Sourcepub fn custom_query_id(&self) -> Option<&CustomQueryId>
pub fn custom_query_id(&self) -> Option<&CustomQueryId>
The name and arguments the query is named by, for a named query.
Sourcepub fn invalid(&self) -> Option<&str>
pub fn invalid(&self) -> Option<&str>
Why the query is invalid: the message JS’s builder throws.
Sourcepub fn name_and_args(self, name: impl Into<String>, args: Vec<Value>) -> Self
pub fn name_and_args(self, name: impl Into<String>, args: Vec<Value>) -> Self
Names the query, as JS’s defineQueries does: the server runs its own
query by name with args, and the client syncs what that returns.
Sourcepub fn one(self) -> Self
pub fn one(self) -> Self
At most one row; the view holds the row or nothing rather than a list.
Sourcepub fn where_(
self,
field: impl Into<String>,
op: SimpleOperator,
value: impl Into<Value>,
) -> Self
pub fn where_( self, field: impl Into<String>, op: SimpleOperator, value: impl Into<Value>, ) -> Self
Rows whose field compares to value by op.
Sourcepub fn where_param(
self,
field: impl Into<String>,
op: SimpleOperator,
param: &StaticParameter,
) -> Self
pub fn where_param( self, field: impl Into<String>, op: SimpleOperator, param: &StaticParameter, ) -> Self
Rows whose field compares to a value of the context by op.
Sourcepub fn where_expr(
self,
factory: impl FnOnce(&ExpressionBuilder<'_>) -> Condition,
) -> Self
pub fn where_expr( self, factory: impl FnOnce(&ExpressionBuilder<'_>) -> Condition, ) -> Self
Rows that match the condition factory builds.
Sourcepub fn where_condition(self, condition: Condition) -> Self
pub fn where_condition(self, condition: Condition) -> Self
Rows that match condition, and any earlier where.
Sourcepub fn where_exists(
self,
relationship: &str,
options: ExistsOptions,
sub: impl FnOnce(AnyQuery) -> AnyQuery,
) -> Self
pub fn where_exists( self, relationship: &str, options: ExistsOptions, sub: impl FnOnce(AnyQuery) -> AnyQuery, ) -> Self
Rows with a related row in relationship that sub matches.
Sourcepub fn start(self, row: Object, inclusive: bool) -> Self
pub fn start(self, row: Object, inclusive: bool) -> Self
Starts after the row with these columns, or at it when inclusive.
Sourcepub fn order_by(self, field: impl Into<String>, direction: Direction) -> Self
pub fn order_by(self, field: impl Into<String>, direction: Direction) -> Self
Orders the rows by field, after any earlier order_by; the primary
key breaks ties.
Includes the rows of relationship, as sub shapes them.
Sourcepub fn sum(self, field: impl Into<String>) -> Self
pub fn sum(self, field: impl Into<String>) -> Self
The sum of field’s non-null values; null when there are none.
Sourcepub fn sum_json(
self,
column: impl Into<String>,
path: Vec<JsonPathSegment>,
) -> Self
pub fn sum_json( self, column: impl Into<String>, path: Vec<JsonPathSegment>, ) -> Self
The sum of the numbers at a JSON path in the json column column.
Sourcepub fn avg(self, field: impl Into<String>) -> Self
pub fn avg(self, field: impl Into<String>) -> Self
The average of field’s non-null values; null when there are none.
Sourcepub fn avg_json(
self,
column: impl Into<String>,
path: Vec<JsonPathSegment>,
) -> Self
pub fn avg_json( self, column: impl Into<String>, path: Vec<JsonPathSegment>, ) -> Self
Reduces the query to the average of the numbers at path in the JSON
column.
Sourcepub fn min(self, field: impl Into<String>) -> Self
pub fn min(self, field: impl Into<String>) -> Self
The least of field’s non-null values; null when there are none.
Sourcepub fn min_json(
self,
column: impl Into<String>,
path: Vec<JsonPathSegment>,
) -> Self
pub fn min_json( self, column: impl Into<String>, path: Vec<JsonPathSegment>, ) -> Self
The least number or string at a JSON path; numbers sort first.
Sourcepub fn max(self, field: impl Into<String>) -> Self
pub fn max(self, field: impl Into<String>) -> Self
The greatest of field’s non-null values; null when there are none.
Sourcepub fn max_json(
self,
column: impl Into<String>,
path: Vec<JsonPathSegment>,
) -> Self
pub fn max_json( self, column: impl Into<String>, path: Vec<JsonPathSegment>, ) -> Self
Reduces the query to the greatest value at path in the JSON column.
Sourcepub fn distinct(self, columns: Vec<String>) -> Self
pub fn distinct(self, columns: Vec<String>) -> Self
The distinct combinations of columns’ values, as SELECT DISTINCT:
rows of those columns. count() after it counts the combinations.
Sourcepub fn group_by(self, columns: Vec<String>) -> AnyGroupedQuery
pub fn group_by(self, columns: Vec<String>) -> AnyGroupedQuery
Groups the rows by columns, as GROUP BY; an aggregate of the
result gives one row per group, with the value under the function’s
name.