use crate::builder::core::{Builder, Dialect};
use crate::builder::steps::{Arg, Ret, Step};
use crate::builder::types::{ColumnPredicate, Condition, LockMode, Statement};
use crate::builder::{AnyBuilder, CaseExpression, JoinType};
use crate::error::{Error, Result};
use crate::query::Query;
use crate::value::{Array, IntoValue, IntoValues, Value};
fn values(values: impl IntoValues) -> Vec<Value> {
values.into_values().values().cloned().collect()
}
pub trait Locking: Dialect {}
pub trait Transactions: Dialect {}
pub trait StatisticalAggregates: Dialect {}
pub trait BitwiseAggregates: Dialect {}
pub trait RawSql: Dialect {}
pub trait CrossJoins: Dialect {}
pub trait FullOuterJoins: Dialect {}
pub trait LateralJoins: Dialect {}
pub trait Rollup: Dialect {
fn with_rollup(b: &mut Builder<Self>);
}
pub trait Cube: Dialect {
fn with_cube(b: &mut Builder<Self>);
}
pub trait Totals: Dialect {
fn with_totals(b: &mut Builder<Self>);
}
pub trait Hints: Dialect {
fn hint(b: &mut Builder<Self>, hint: &str) -> Result<()>;
}
pub trait ConditionalAggregates: Dialect {
fn aggregate_filter(
b: &mut Builder<Self>,
aggregate: &str,
column: Option<&str>,
condition: &str,
alias: &str,
) -> Result<String> {
let then = match column {
None => "1".to_owned(),
Some(c) => b.resolve_and_wrap(c)?,
};
let mut expression = format!("{aggregate}(CASE WHEN {condition} THEN {then} END)");
if !alias.is_empty() {
expression.push_str(" AS ");
expression.push_str(&b.quote(alias)?);
}
Ok(expression)
}
}
pub(crate) fn aggregates_base_step<D: StringAggregates>(step: Step, arguments: &[Arg<'_>]) -> Option<Result<Ret>> {
Some(Ok(Ret::Str(match (step, arguments) {
(Step::GroupConcatExpr, [Arg::Str(column), Arg::Str(order_by)]) => D::group_concat_expr(column, order_by),
(Step::JsonArrayAggExpr, [Arg::Str(column)]) => D::json_array_agg_expr(column),
(Step::JsonObjectAggExpr, [Arg::Str(key), Arg::Str(value)]) => D::json_object_agg_expr(key, value),
_ => return None,
})))
}
pub trait StringAggregates: Dialect {
fn group_concat_expr(column: &str, order_by: &str) -> String;
fn json_array_agg_expr(column: &str) -> String;
fn json_object_agg_expr(key: &str, value: &str) -> String;
}
pub trait Json: Dialect {
fn set_json_append(b: &mut Builder<Self>, column: &str, values: &Array) -> Result<()>;
fn set_json_prepend(b: &mut Builder<Self>, column: &str, values: &Array) -> Result<()>;
fn set_json_insert(b: &mut Builder<Self>, column: &str, index: i64, value: Value) -> Result<()>;
fn set_json_remove(b: &mut Builder<Self>, column: &str, value: Value) -> Result<()>;
fn set_json_intersect(b: &mut Builder<Self>, column: &str, values: &Array) -> Result<()>;
fn set_json_diff(b: &mut Builder<Self>, column: &str, values: &Array) -> Result<()>;
fn set_json_unique(b: &mut Builder<Self>, column: &str) -> Result<()>;
fn set_json_path(b: &mut Builder<Self>, column: &str, path: &str, value: Value) -> Result<()>;
}
pub trait Spatial: Dialect {}
pub trait FullTextSearch: Dialect {
fn filter_search(b: &mut Builder<Self>, attribute: &str, value: &str) -> Result<()> {
b.core.pending.push(Query::search(attribute, value));
Ok(())
}
}
pub trait NegatedFullTextSearch: Dialect {}
pub trait Upsert: Dialect {
fn upsert(b: &mut Builder<Self>) -> Result<Statement>;
}
pub trait UpsertSelect: Dialect {
fn upsert_select(b: &mut Builder<Self>) -> Result<Statement>;
}
pub trait InsertOrIgnore: Dialect {
fn insert_or_ignore(b: &mut Builder<Self>) -> Result<Statement>;
}
pub trait TableSampling: Dialect {
fn tablesample(b: &mut Builder<Self>, percent: f64, method: &str) -> Result<()>;
}
pub trait Sequences: Dialect {
fn sequence_expression(b: &mut Builder<Self>, next: bool, sequence: &str) -> Result<String>;
}
pub trait Returning: Dialect {}
pub(crate) fn is_plain_identifier(name: &str) -> bool {
let bytes = name.as_bytes();
match bytes.split_first() {
Some((first, rest)) => {
(first.is_ascii_alphabetic() || *first == b'_')
&& rest.iter().all(|b| b.is_ascii_alphanumeric() || *b == b'_')
}
None => false,
}
}
pub(crate) fn is_cast_type(text: &str) -> bool {
let text = text.as_bytes();
let is_space = |b: u8| matches!(b, b' ' | b'\t' | b'\n' | b'\r' | b'\x0B' | b'\x0C');
let word_start = |b: u8| b.is_ascii_alphabetic() || b == b'_';
let word = |b: u8| b.is_ascii_alphanumeric() || b == b'_';
let mut i = 0;
if !text.first().is_some_and(|&b| word_start(b)) {
return false;
}
while i < text.len() && word(text[i]) {
i += 1;
}
loop {
let mut j = i;
while j < text.len() && is_space(text[j]) {
j += 1;
}
if j > i && j < text.len() && word_start(text[j]) {
i = j;
while i < text.len() && word(text[i]) {
i += 1;
}
} else {
break;
}
}
if i == text.len() {
return true;
}
while i < text.len() && is_space(text[i]) {
i += 1;
}
if text.get(i) != Some(&b'(') || text.last() != Some(&b')') || i + 1 >= text.len() - 1 {
return false;
}
let inner = &text[i + 1..text.len() - 1];
inner.iter().all(|&b| word(b) || b == b',' || is_space(b))
}
impl<D: Locking> Builder<D> {
pub fn for_update(&mut self) -> &mut Self {
self.core.lock_mode = Some(LockMode::ForUpdate);
self
}
pub fn for_share(&mut self) -> &mut Self {
self.core.lock_mode = Some(LockMode::ForShare);
self
}
pub fn for_update_skip_locked(&mut self) -> &mut Self {
self.core.lock_mode = Some(LockMode::ForUpdateSkipLocked);
self
}
pub fn for_update_no_wait(&mut self) -> &mut Self {
self.core.lock_mode = Some(LockMode::ForUpdateNoWait);
self
}
pub fn for_share_skip_locked(&mut self) -> &mut Self {
self.core.lock_mode = Some(LockMode::ForShareSkipLocked);
self
}
pub fn for_share_no_wait(&mut self) -> &mut Self {
self.core.lock_mode = Some(LockMode::ForShareNoWait);
self
}
}
impl<D: Transactions> Builder<D> {
pub fn begin(&self) -> Statement {
Statement::with_parts("BEGIN", Vec::new(), false, self.core.executor.clone(), None)
}
pub fn commit(&self) -> Statement {
Statement::with_parts("COMMIT", Vec::new(), false, self.core.executor.clone(), None)
}
pub fn rollback(&self) -> Statement {
Statement::with_parts("ROLLBACK", Vec::new(), false, self.core.executor.clone(), None)
}
pub fn savepoint(&mut self, name: &str) -> Result<Statement> {
Ok(Statement::with_parts(
format!("SAVEPOINT {}", self.quote(name)?),
Vec::new(),
false,
self.core.executor.clone(),
None,
))
}
pub fn release_savepoint(&mut self, name: &str) -> Result<Statement> {
Ok(Statement::with_parts(
format!("RELEASE SAVEPOINT {}", self.quote(name)?),
Vec::new(),
false,
self.core.executor.clone(),
None,
))
}
pub fn rollback_to_savepoint(&mut self, name: &str) -> Result<Statement> {
Ok(Statement::with_parts(
format!("ROLLBACK TO SAVEPOINT {}", self.quote(name)?),
Vec::new(),
false,
self.core.executor.clone(),
None,
))
}
}
impl<D: StatisticalAggregates> Builder<D> {
pub fn stddev(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::stddev(attribute, alias));
self
}
pub fn stddev_pop(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::stddev_pop(attribute, alias));
self
}
pub fn stddev_samp(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::stddev_samp(attribute, alias));
self
}
pub fn variance(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::variance(attribute, alias));
self
}
pub fn var_pop(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::var_pop(attribute, alias));
self
}
pub fn var_samp(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::var_samp(attribute, alias));
self
}
}
impl<D: BitwiseAggregates> Builder<D> {
pub fn bit_and(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::bit_and(attribute, alias));
self
}
pub fn bit_or(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::bit_or(attribute, alias));
self
}
pub fn bit_xor(&mut self, attribute: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::bit_xor(attribute, alias));
self
}
}
impl<D: RawSql> Builder<D> {
pub fn select_cast(&mut self, column: &str, cast_type: &str, alias: &str) -> Result<&mut Self> {
if !is_cast_type(cast_type) {
return Err(Error::Validation(format!("Invalid cast type: {cast_type}")));
}
let mut expression = format!("CAST({} AS {cast_type})", self.resolve_and_wrap(column)?);
if !alias.is_empty() {
expression.push_str(" AS ");
expression.push_str(&self.quote(alias)?);
}
self.core.raw_selects.push(Condition::new(expression, Vec::new()));
Ok(self)
}
pub fn order_by_raw(&mut self, expression: impl Into<String>, bindings: impl IntoValues) -> &mut Self {
self.core.raw_orders.push(Condition::new(expression, values(bindings)));
self
}
pub fn group_by_raw(&mut self, expression: impl Into<String>, bindings: impl IntoValues) -> &mut Self {
self.core.raw_groups.push(Condition::new(expression, values(bindings)));
self
}
pub fn having_raw(&mut self, expression: impl Into<String>, bindings: impl IntoValues) -> &mut Self {
self.core.raw_havings.push(Condition::new(expression, values(bindings)));
self
}
pub fn where_raw(&mut self, expression: impl Into<String>, bindings: impl IntoValues) -> &mut Self {
self.core.raw_wheres.push(Condition::new(expression, values(bindings)));
self
}
pub fn where_column(&mut self, left: &str, operator: &str, right: &str) -> Result<&mut Self> {
if !["=", "!=", "<>", "<", ">", "<=", ">="].contains(&operator) {
return Err(Error::Validation(format!("Invalid whereColumn operator: {operator}")));
}
self.core.column_predicates.push(ColumnPredicate::new(left, operator, right));
Ok(self)
}
pub fn select_case(&mut self, case: CaseExpression) -> &mut Self {
self.push_case(case);
self
}
pub fn set_case(&mut self, column: impl Into<String>, case: CaseExpression) -> &mut Self {
self.core.case_sets.set(column, case);
self
}
pub fn set_raw(
&mut self,
column: impl Into<String>,
expression: impl Into<String>,
bindings: impl IntoValues,
) -> &mut Self {
let column = column.into();
self.core.raw_sets.set(column.clone(), expression.into());
self.core.raw_set_bindings.set(column, values(bindings));
self
}
pub fn conflict_set_raw(
&mut self,
column: impl Into<String>,
expression: impl Into<String>,
bindings: impl IntoValues,
) -> &mut Self {
let column = column.into();
self.core.conflict_raw_sets.set(column.clone(), expression.into());
self.core.conflict_raw_set_bindings.set(column, values(bindings));
self
}
pub fn insert_column_expression(
&mut self,
column: impl Into<String>,
expression: impl Into<String>,
extra_bindings: impl IntoValues,
) -> &mut Self {
let column = column.into();
let extra = values(extra_bindings);
self.core.insert_column_expressions.set(column.clone(), expression.into());
if !extra.is_empty() {
self.core.insert_column_expression_bindings.set(column, extra);
}
self
}
}
impl<D: CrossJoins> Builder<D> {
pub fn cross_join(&mut self, table: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::new(crate::Method::CrossJoin, table, Array::default(), alias));
self
}
pub fn natural_join(&mut self, table: impl Into<String>, alias: impl Into<String>) -> &mut Self {
self.core.pending.push(Query::new(crate::Method::NaturalJoin, table, Array::default(), alias));
self
}
}
impl<D: FullOuterJoins> Builder<D> {
pub fn full_outer_join(
&mut self,
table: impl Into<String>,
left: &str,
right: &str,
operator: &str,
alias: impl Into<String>,
) -> &mut Self {
let on = Query::on(left, right, operator);
self.core.pending.push(Query::new(crate::Method::FullOuterJoin, table, crate::value::list([on]), alias));
self
}
}
impl<D: LateralJoins> Builder<D> {
pub fn join_lateral(
&mut self,
subquery: Box<dyn AnyBuilder>,
alias: impl Into<String>,
join_type: JoinType,
) -> &mut Self {
self.add_lateral(subquery, alias.into(), join_type);
self
}
pub fn left_join_lateral(&mut self, subquery: Box<dyn AnyBuilder>, alias: impl Into<String>) -> &mut Self {
self.join_lateral(subquery, alias, JoinType::Left)
}
}
impl<D: Rollup> Builder<D> {
pub fn with_rollup(&mut self) -> &mut Self {
D::with_rollup(self);
self
}
}
impl<D: Cube> Builder<D> {
pub fn with_cube(&mut self) -> &mut Self {
D::with_cube(self);
self
}
}
impl<D: Totals> Builder<D> {
pub fn with_totals(&mut self) -> &mut Self {
D::with_totals(self);
self
}
}
impl<D: Hints> Builder<D> {
pub fn hint(&mut self, hint: &str) -> Result<&mut Self> {
D::hint(self, hint)?;
Ok(self)
}
}
impl<D: ConditionalAggregates> Builder<D> {
fn conditional(
&mut self,
aggregate: &str,
column: Option<&str>,
condition: &str,
alias: &str,
bindings: impl IntoValues,
) -> Result<&mut Self> {
let expression = D::aggregate_filter(self, aggregate, column, condition, alias)?;
Ok(self.select_raw(expression, bindings))
}
pub fn count_when(&mut self, condition: &str, alias: &str, bindings: impl IntoValues) -> Result<&mut Self> {
self.conditional("COUNT", None, condition, alias, bindings)
}
pub fn sum_when(
&mut self,
column: &str,
condition: &str,
alias: &str,
bindings: impl IntoValues,
) -> Result<&mut Self> {
self.conditional("SUM", Some(column), condition, alias, bindings)
}
pub fn avg_when(
&mut self,
column: &str,
condition: &str,
alias: &str,
bindings: impl IntoValues,
) -> Result<&mut Self> {
self.conditional("AVG", Some(column), condition, alias, bindings)
}
pub fn min_when(
&mut self,
column: &str,
condition: &str,
alias: &str,
bindings: impl IntoValues,
) -> Result<&mut Self> {
self.conditional("MIN", Some(column), condition, alias, bindings)
}
pub fn max_when(
&mut self,
column: &str,
condition: &str,
alias: &str,
bindings: impl IntoValues,
) -> Result<&mut Self> {
self.conditional("MAX", Some(column), condition, alias, bindings)
}
}
impl<D: StringAggregates> Builder<D> {
pub fn group_concat(
&mut self,
column: &str,
separator: &str,
alias: &str,
order_by: Option<&[String]>,
) -> Result<&mut Self> {
let order = match order_by {
Some(columns) if !columns.is_empty() => format!("ORDER BY {}", self.compile_order_by_list(columns)?),
_ => String::new(),
};
let wrapped = self.resolve_and_wrap(column)?;
let mut expression = self.step_string(Step::GroupConcatExpr, &[Arg::Str(&wrapped), Arg::Str(&order)])?;
if !alias.is_empty() {
expression.push_str(" AS ");
expression.push_str(&self.quote(alias)?);
}
Ok(self.select_raw(expression, [separator]))
}
pub fn json_array_agg(&mut self, column: &str, alias: &str) -> Result<&mut Self> {
let wrapped = self.resolve_and_wrap(column)?;
let mut expression = self.step_string(Step::JsonArrayAggExpr, &[Arg::Str(&wrapped)])?;
if !alias.is_empty() {
expression.push_str(" AS ");
expression.push_str(&self.quote(alias)?);
}
Ok(self.select_raw(expression, Array::default()))
}
pub fn json_object_agg(&mut self, key_column: &str, value_column: &str, alias: &str) -> Result<&mut Self> {
let key = self.resolve_and_wrap(key_column)?;
let value = self.resolve_and_wrap(value_column)?;
let mut expression = self.step_string(Step::JsonObjectAggExpr, &[Arg::Str(&key), Arg::Str(&value)])?;
if !alias.is_empty() {
expression.push_str(" AS ");
expression.push_str(&self.quote(alias)?);
}
Ok(self.select_raw(expression, Array::default()))
}
}
impl<D: Json> Builder<D> {
pub fn filter_json_contains(&mut self, attribute: impl Into<String>, value: impl IntoValue) -> &mut Self {
self.core.pending.push(Query::json_contains(attribute, value));
self
}
pub fn filter_json_not_contains(&mut self, attribute: impl Into<String>, value: impl IntoValue) -> &mut Self {
self.core.pending.push(Query::json_not_contains(attribute, value));
self
}
pub fn filter_json_overlaps(&mut self, attribute: impl Into<String>, values: impl IntoValues) -> &mut Self {
self.core.pending.push(Query::json_overlaps(attribute, values.into_values()));
self
}
pub fn filter_json_path(
&mut self,
attribute: impl Into<String>,
path: &str,
operator: &str,
value: impl IntoValue,
) -> &mut Self {
self.core.pending.push(Query::json_path(attribute, path, operator, value));
self
}
pub fn set_json_append(&mut self, column: &str, values: impl IntoValues) -> Result<&mut Self> {
D::set_json_append(self, column, &values.into_values())?;
Ok(self)
}
pub fn set_json_prepend(&mut self, column: &str, values: impl IntoValues) -> Result<&mut Self> {
D::set_json_prepend(self, column, &values.into_values())?;
Ok(self)
}
pub fn set_json_insert(&mut self, column: &str, index: i64, value: impl IntoValue) -> Result<&mut Self> {
D::set_json_insert(self, column, index, value.into_value())?;
Ok(self)
}
pub fn set_json_remove(&mut self, column: &str, value: impl IntoValue) -> Result<&mut Self> {
D::set_json_remove(self, column, value.into_value())?;
Ok(self)
}
pub fn set_json_intersect(&mut self, column: &str, values: impl IntoValues) -> Result<&mut Self> {
D::set_json_intersect(self, column, &values.into_values())?;
Ok(self)
}
pub fn set_json_diff(&mut self, column: &str, values: impl IntoValues) -> Result<&mut Self> {
D::set_json_diff(self, column, &values.into_values())?;
Ok(self)
}
pub fn set_json_unique(&mut self, column: &str) -> Result<&mut Self> {
D::set_json_unique(self, column)?;
Ok(self)
}
pub fn set_json_path(&mut self, column: &str, path: &str, value: impl IntoValue) -> Result<&mut Self> {
D::set_json_path(self, column, path, value.into_value())?;
Ok(self)
}
}
impl<D: FullTextSearch> Builder<D> {
pub fn filter_search(&mut self, attribute: &str, value: &str) -> Result<&mut Self> {
D::filter_search(self, attribute, value)?;
Ok(self)
}
}
impl<D: NegatedFullTextSearch> Builder<D> {
pub fn filter_not_search(&mut self, attribute: &str, value: &str) -> &mut Self {
self.core.pending.push(Query::not_search(attribute, value));
self
}
}
impl<D: Upsert> Builder<D> {
pub fn upsert(&mut self) -> Result<Statement> {
self.check_deferred()?;
D::upsert(self)
}
}
impl<D: UpsertSelect> Builder<D> {
pub fn upsert_select(&mut self) -> Result<Statement> {
self.check_deferred()?;
D::upsert_select(self)
}
}
impl<D: InsertOrIgnore> Builder<D> {
pub fn insert_or_ignore(&mut self) -> Result<Statement> {
self.check_deferred()?;
D::insert_or_ignore(self)
}
}
impl<D: TableSampling> Builder<D> {
pub fn tablesample(&mut self, percent: f64, method: &str) -> Result<&mut Self> {
D::tablesample(self, percent, method)?;
Ok(self)
}
}
impl<D: Sequences> Builder<D> {
fn sequence(&mut self, next: bool, sequence: &str, alias: &str) -> Result<&mut Self> {
if !is_plain_identifier(sequence) {
return Err(Error::Validation(format!("Invalid sequence name: {sequence}")));
}
let mut expression = D::sequence_expression(self, next, sequence)?;
if !alias.is_empty() {
if !is_plain_identifier(alias) {
return Err(Error::Validation(format!("Invalid sequence alias: {alias}")));
}
expression.push_str(" AS ");
expression.push_str(&self.quote(alias)?);
}
Ok(self.select_raw(expression, Array::default()))
}
pub fn next_val(&mut self, sequence: &str, alias: &str) -> Result<&mut Self> {
self.sequence(true, sequence, alias)
}
pub fn curr_val(&mut self, sequence: &str, alias: &str) -> Result<&mut Self> {
self.sequence(false, sequence, alias)
}
}
impl<D: Returning> Builder<D> {
pub fn returning<S: Into<String>>(&mut self, columns: impl IntoIterator<Item = S>) -> &mut Self {
self.core.returning = columns.into_iter().map(Into::into).collect();
self
}
}
impl<D: Spatial> Builder<D> {
pub fn filter_distance(
&mut self,
attribute: impl Into<String>,
point: &Array,
operator: &str,
distance: f64,
meters: bool,
) -> crate::Result<&mut Self> {
let point = Value::Array(point.clone());
let wkt = format!("POINT({})", crate::builder::sql::point_wkt(Some(&point))?);
let method = match operator {
">" => crate::Method::DistanceGreaterThan,
"=" => crate::Method::DistanceEqual,
"!=" => crate::Method::DistanceNotEqual,
_ => crate::Method::DistanceLessThan,
};
let tuple = crate::value::list([crate::value::string(wkt), Value::Float(distance), Value::Bool(meters)]);
self.core.pending.push(Query::new(method, attribute, crate::value::list([Value::Array(tuple)]), ""));
Ok(self)
}
pub fn filter_intersects(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::intersects(attribute, geometry));
self
}
pub fn filter_not_intersects(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::not_intersects(attribute, geometry));
self
}
pub fn filter_crosses(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::crosses(attribute, geometry));
self
}
pub fn filter_not_crosses(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::not_crosses(attribute, geometry));
self
}
pub fn filter_overlaps(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::overlaps(attribute, geometry));
self
}
pub fn filter_not_overlaps(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::not_overlaps(attribute, geometry));
self
}
pub fn filter_touches(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::touches(attribute, geometry));
self
}
pub fn filter_not_touches(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::not_touches(attribute, geometry));
self
}
pub fn filter_covers(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::covers(attribute, geometry));
self
}
pub fn filter_not_covers(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::not_covers(attribute, geometry));
self
}
pub fn filter_spatial_equals(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::spatial_equals(attribute, geometry));
self
}
pub fn filter_not_spatial_equals(&mut self, attribute: impl Into<String>, geometry: Array) -> &mut Self {
self.core.pending.push(Query::not_spatial_equals(attribute, geometry));
self
}
}